[Python-checkins] r78780 - in python/branches/py3k: Lib/email/message.py Lib/email/test/data/msg_10.txt Lib/email/test/test_email.py Misc/ACKS

r.david.murray python-checkins at python.org
Mon Mar 8 03:17:05 CET 2010


Author: r.david.murray
Date: Mon Mar  8 03:17:03 2010
New Revision: 78780

Log:
bdecode was already gone in email 5.  This merge adds the test from
the trunk patch, and removes the last trace of bdecode, which was
a commented out call in message.py.

Merged revisions 78778 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r78778 | r.david.murray | 2010-03-07 21:04:06 -0500 (Sun, 07 Mar 2010) | 9 lines
  
  Issue #7143: get_payload used to strip any trailing newline from a
  base64 transfer-encoded payload *after* decoding it; it no longer does.
  email had a special method in utils, _bdecode, specifically to do this,
  so it must have served a purpose at some point, yet it is clearly wrong
  per RFC.  Fixed with Barry's approval, but no backport.  Email package
  minor version number is bumped, now version 4.0.1.
  
  Patch by Joaquin Cuenca Abela.
........


Modified:
   python/branches/py3k/   (props changed)
   python/branches/py3k/Lib/email/message.py
   python/branches/py3k/Lib/email/test/data/msg_10.txt
   python/branches/py3k/Lib/email/test/test_email.py
   python/branches/py3k/Misc/ACKS

Modified: python/branches/py3k/Lib/email/message.py
==============================================================================
--- python/branches/py3k/Lib/email/message.py	(original)
+++ python/branches/py3k/Lib/email/message.py	Mon Mar  8 03:17:03 2010
@@ -204,7 +204,6 @@
                 if isinstance(payload, str):
                     payload = payload.encode('raw-unicode-escape')
                 return base64.b64decode(payload)
-                #return utils._bdecode(payload)
             except binascii.Error:
                 # Incorrect padding
                 pass

Modified: python/branches/py3k/Lib/email/test/data/msg_10.txt
==============================================================================
--- python/branches/py3k/Lib/email/test/data/msg_10.txt	(original)
+++ python/branches/py3k/Lib/email/test/data/msg_10.txt	Mon Mar  8 03:17:03 2010
@@ -26,6 +26,13 @@
 
 --BOUNDARY
 Content-Type: text/plain; charset="iso-8859-1"
+Content-Transfer-Encoding: Base64
+
+VGhpcyBpcyBhIEJhc2U2NCBlbmNvZGVkIG1lc3NhZ2UuCg==
+
+
+--BOUNDARY
+Content-Type: text/plain; charset="iso-8859-1"
 
 This has no Content-Transfer-Encoding: header.
 

Modified: python/branches/py3k/Lib/email/test/test_email.py
==============================================================================
--- python/branches/py3k/Lib/email/test/test_email.py	(original)
+++ python/branches/py3k/Lib/email/test/test_email.py	Mon Mar  8 03:17:03 2010
@@ -204,8 +204,12 @@
         # Subpart 3 is base64
         eq(msg.get_payload(2).get_payload(decode=True),
            b'This is a Base64 encoded message.')
-        # Subpart 4 has no Content-Transfer-Encoding: header.
+        # Subpart 4 is base64 with a trailing newline, which
+        # used to be stripped (issue 7143).
         eq(msg.get_payload(3).get_payload(decode=True),
+           b'This is a Base64 encoded message.\n')
+        # Subpart 5 has no Content-Transfer-Encoding: header.
+        eq(msg.get_payload(4).get_payload(decode=True),
            b'This has no Content-Transfer-Encoding: header.\n')
 
     def test_get_decoded_uu_payload(self):

Modified: python/branches/py3k/Misc/ACKS
==============================================================================
--- python/branches/py3k/Misc/ACKS	(original)
+++ python/branches/py3k/Misc/ACKS	Mon Mar  8 03:17:03 2010
@@ -9,6 +9,7 @@
 
 PS: In the standard Python distribution, this file is encoded in UTF-8.
 
+Joaquin Cuenca Abela
 David Abrahams
 Jim Ahlstrom
 Farhan Ahmad


More information about the Python-checkins mailing list