This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Email message croaks the new email pkg parser
Type: Stage:
Components: Library (Lib) Versions: Python 2.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: barry Nosy List: barry, skip.montanaro
Priority: normal Keywords:

Created on 2004-09-20 00:34 by skip.montanaro, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
badmsg skip.montanaro, 2004-09-20 00:34
msg_42.txt barry, 2004-09-30 03:59
Messages (3)
msg22496 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2004-09-20 00:34
The new parser for the email package croaks with an 
AssertionError on the attached email message.  Here's the 
traceback:

Traceback (most recent call last):
  File "/Users/skip/local/lib/python2.4/site-packages/
spambayes/mboxutils.py", line 129, in get_message
    msg = email.message_from_string(obj)
  File "/Users/skip/local/lib/python2.4/email/__init__.py", 
line 45, in message_from_string
    return Parser(_class, strict=strict).parsestr(s)
  File "/Users/skip/local/lib/python2.4/email/Parser.py", line 
67, in parsestr
    return self.parse(StringIO(text), 
headersonly=headersonly)
  File "/Users/skip/local/lib/python2.4/email/Parser.py", line 
56, in parse
    feedparser.feed(data)
  File "/Users/skip/local/lib/python2.4/email/FeedParser.py", 
line 145, in feed
    self._call_parse()
  File "/Users/skip/local/lib/python2.4/email/FeedParser.py", 
line 149, in _call_parse
    self._parse()
  File "/Users/skip/local/lib/python2.4/email/FeedParser.py", 
line 359, in _parsegen
    assert capturing_preamble

Assigning to Barry on the outside chance that he'll have 
enough round tuits to fix this before the 2.4 release.
msg22497 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2004-09-30 03:59
Logged In: YES 
user_id=12800

msg_42.txt is the boiled down example that evokes the assertion.
msg22498 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2004-10-09 23:00
Logged In: YES 
user_id=12800

I figured out what was wrong with msg_42.txt -- it has no
start boundary.  In that case the epilogue between the
--BBB-- end boundary and the --AAA-- end boundary wasn't
being consumed.  Fixed in FeedParser.py 1.11, with a test case.

Note that while the message will get parsed without an
assertion now, it the innermost message (i.e. the [*] below)
will have a StartBoundaryNotFoundDefect set.

structure of msg_42.txt:

multipart/mixed
    text/plain
    message/rfc822
         multipart/mixed [*]
History
Date User Action Args
2022-04-11 14:56:07adminsetgithub: 40931
2004-09-20 00:34:46skip.montanarocreate