summaryrefslogtreecommitdiffstats
path: root/Lib/email/feedparser.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/email/feedparser.py')
-rw-r--r--Lib/email/feedparser.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/Lib/email/feedparser.py b/Lib/email/feedparser.py
index 8db70b3..60a8325 100644
--- a/Lib/email/feedparser.py
+++ b/Lib/email/feedparser.py
@@ -368,12 +368,12 @@ class FeedParser:
end = len(mo.group(0))
self._last.epilogue = epilogue[:-end]
else:
- payload = self._last.get_payload()
+ payload = self._last._payload
if isinstance(payload, str):
mo = NLCRE_eol.search(payload)
if mo:
payload = payload[:-len(mo.group(0))]
- self._last.set_payload(payload)
+ self._last._payload = payload
self._input.pop_eof_matcher()
self._pop_message()
# Set the multipart up for newline cleansing, which will
@@ -482,3 +482,10 @@ class FeedParser:
if lastheader:
# XXX reconsider the joining of folded lines
self._cur[lastheader] = EMPTYSTRING.join(lastvalue).rstrip('\r\n')
+
+
+class BytesFeedParser(FeedParser):
+ """Like FeedParser, but feed accepts bytes."""
+
+ def feed(self, data):
+ super().feed(data.decode('ascii', 'surrogateescape'))