summaryrefslogtreecommitdiff
path: root/Lib/email/feedparser.py
diff options
context:
space:
mode:
authorR. David Murray <rdmurray@bitdance.com>2010-10-08 15:55:28 +0000
committerR. David Murray <rdmurray@bitdance.com>2010-10-08 15:55:28 +0000
commitfe335b31a268d1f06b9081ae6355152a10e7bada (patch)
treeba6821a969a00f9ea3b04a572c415c6a9ba015ed /Lib/email/feedparser.py
parente43783b7ce2fdb3f3347896f1834d9caf7f2a327 (diff)
downloadcpython-fe335b31a268d1f06b9081ae6355152a10e7bada.tar.gz
#4661: add bytes parsing and generation to email (email version bump to 5.1.0)
The work on this is not 100% complete, but everything is present to allow real-world testing of the code. The only remaining major todo item is to (hopefully!) enhance the handling of non-ASCII bytes in headers converted to unicode by RFC2047 encoding them rather than replacing them with '?'s.
Diffstat (limited to 'Lib/email/feedparser.py')
-rw-r--r--Lib/email/feedparser.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/email/feedparser.py b/Lib/email/feedparser.py
index 8db70b3c36..de8750dc16 100644
--- a/Lib/email/feedparser.py
+++ b/Lib/email/feedparser.py
@@ -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'))