summaryrefslogtreecommitdiffstats
path: root/Lib/email
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2004-10-09 23:00:11 (GMT)
committerBarry Warsaw <barry@python.org>2004-10-09 23:00:11 (GMT)
commitdee0cf12e3430e146738fd0d7a16a35071e3b913 (patch)
tree49550efa1ae9e834f5be3241b8c9d830c40fd4ee /Lib/email
parent6bd55ee1ef98ddf72a2707f64e3a8606b2e3da05 (diff)
downloadcpython-dee0cf12e3430e146738fd0d7a16a35071e3b913.zip
cpython-dee0cf12e3430e146738fd0d7a16a35071e3b913.tar.gz
cpython-dee0cf12e3430e146738fd0d7a16a35071e3b913.tar.bz2
Fix SF bug # 1030941. In _parsegen(), in the clause where we're
capturing_preamble but we found a StartBoundaryNotFoundDefect, we need to consume all lines from the current position to the EOF, which we'll set as the epilogue of the current message. If we're not at EOF when we return from here, the outer message's capturing_preamble assertion will fail.
Diffstat (limited to 'Lib/email')
-rw-r--r--Lib/email/FeedParser.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/Lib/email/FeedParser.py b/Lib/email/FeedParser.py
index de2754e..1d6e3dd 100644
--- a/Lib/email/FeedParser.py
+++ b/Lib/email/FeedParser.py
@@ -309,8 +309,6 @@ class FeedParser:
if eolmo:
preamble[-1] = lastline[:-len(eolmo.group(0))]
self._cur.preamble = EMPTYSTRING.join(preamble)
- #import pdb ; pdb.set_trace()
- # See SF bug #1030941
capturing_preamble = False
self._input.unreadline(line)
continue
@@ -367,10 +365,16 @@ class FeedParser:
# We've seen either the EOF or the end boundary. If we're still
# capturing the preamble, we never saw the start boundary. Note
# that as a defect and store the captured text as the payload.
- # Otherwise everything from here to the EOF is epilogue.
+ # Everything from here to the EOF is epilogue.
if capturing_preamble:
self._cur.defects.append(Errors.StartBoundaryNotFoundDefect())
self._cur.set_payload(EMPTYSTRING.join(preamble))
+ epilogue = []
+ for line in self._input:
+ if line is NeedMoreData:
+ yield NeedMoreData
+ continue
+ self._cur.epilogue = EMPTYSTRING.join(epilogue)
return
# If the end boundary ended in a newline, we'll need to make sure
# the epilogue isn't None