diff options
author | R. David Murray <rdmurray@bitdance.com> | 2010-10-01 15:45:48 (GMT) |
---|---|---|
committer | R. David Murray <rdmurray@bitdance.com> | 2010-10-01 15:45:48 (GMT) |
commit | f9c957f2c6d1fb59d1817a24892b1e792fa0c66c (patch) | |
tree | ddd15be2793e78b2cb29edd394d36051fb95751b | |
parent | eccd4d910dc61d5ad8ccc9c62d3ab823b359aa9d (diff) | |
download | cpython-f9c957f2c6d1fb59d1817a24892b1e792fa0c66c.zip cpython-f9c957f2c6d1fb59d1817a24892b1e792fa0c66c.tar.gz cpython-f9c957f2c6d1fb59d1817a24892b1e792fa0c66c.tar.bz2 |
Merged revisions 85142 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r85142 | r.david.murray | 2010-10-01 11:40:20 -0400 (Fri, 01 Oct 2010) | 5 lines
#10004: in Q encoded word ignore '=xx' when xx is not valid hex.
Bug report and fix by Thomas Guettler.
........
-rw-r--r-- | Lib/email/quoprimime.py | 2 | ||||
-rw-r--r-- | Lib/email/test/test_email.py | 6 | ||||
-rw-r--r-- | Misc/NEWS | 3 |
3 files changed, 10 insertions, 1 deletions
diff --git a/Lib/email/quoprimime.py b/Lib/email/quoprimime.py index bf28d39..85efc08 100644 --- a/Lib/email/quoprimime.py +++ b/Lib/email/quoprimime.py @@ -294,4 +294,4 @@ def header_decode(s): the high level email.Header class for that functionality. """ s = s.replace('_', ' ') - return re.sub(r'=\w{2}', _unquote_match, s, re.ASCII) + return re.sub(r'=[a-fA-F0-9]{2}', _unquote_match, s, re.ASCII) diff --git a/Lib/email/test/test_email.py b/Lib/email/test/test_email.py index d5ac9c4..42a2ee3 100644 --- a/Lib/email/test/test_email.py +++ b/Lib/email/test/test_email.py @@ -1655,6 +1655,12 @@ Re: =?mac-iceland?q?r=8Aksm=9Arg=8Cs?= baz foo bar =?mac-iceland?q?r=8Aksm?= dh = decode_header(s % q) self.assertEqual(dh, [(a, 'iso-8859-1')]) + def test_rfc2047_Q_invalid_digits(self): + # issue 10004. + s = '=?iso-8659-1?Q?andr=e9=zz?=' + self.assertEqual(decode_header(s), + [(b'andr\xe9=zz', 'iso-8659-1')]) + # Test the MIMEMessage class class TestMIMEMessage(TestEmailBase): @@ -121,6 +121,9 @@ C-API Library ------- +- Issue #10004: quoprimime no longer generates a traceback when confronted + with invalid characters after '=' in a Q-encoded word. + - Issue #9950: Fix socket.sendall() crash or misbehaviour when a signal is received. Now sendall() properly calls signal handlers if necessary, and retries sending if these returned successfully, including on sockets |