[Python-checkins] python/dist/src/Lib/email FeedParser.py, 1.11, 1.12

bwarsaw at users.sourceforge.net bwarsaw at users.sourceforge.net
Sun Nov 28 01:21:45 CET 2004


Update of /cvsroot/python/python/dist/src/Lib/email
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6103/Lib/email

Modified Files:
	FeedParser.py 
Log Message:
Fix for SF bug #1072623.  When the last line of the input string does not end
in a newline, and it's an end boundary, the FeedParser wasn't recognizing it
as such.  Tweak the regexp to make the ending linesep optional.

For grins, clear self._partial when closing the BufferedSubFile.

Added a test case.



Index: FeedParser.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/email/FeedParser.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- FeedParser.py	9 Oct 2004 23:00:11 -0000	1.11
+++ FeedParser.py	28 Nov 2004 00:21:41 -0000	1.12
@@ -62,6 +62,7 @@
     def close(self):
         # Don't forget any trailing partial line.
         self._lines.append(self._partial)
+        self._partial = ''
         self._closed = True
 
     def readline(self):
@@ -279,7 +280,7 @@
             separator = '--' + boundary
             boundaryre = re.compile(
                 '(?P<sep>' + re.escape(separator) +
-                r')(?P<end>--)?(?P<ws>[ \t]*)(?P<linesep>\r\n|\r|\n)$')
+                r')(?P<end>--)?(?P<ws>[ \t]*)(?P<linesep>\r\n|\r|\n)?$')
             capturing_preamble = True
             preamble = []
             linesep = False



More information about the Python-checkins mailing list