]> granicus.if.org Git - python/commitdiff
#18380: pass regex flags to the right argument. Patch by Valentina Mukhamedzhanova.
authorEzio Melotti <ezio.melotti@gmail.com>
Sat, 6 Jul 2013 15:16:04 +0000 (17:16 +0200)
committerEzio Melotti <ezio.melotti@gmail.com>
Sat, 6 Jul 2013 15:16:04 +0000 (17:16 +0200)
Lib/email/quoprimime.py
Lib/test/test_email/test_email.py
Misc/ACKS

index 78638d5904c1f1c85e990ed57d9596cc34b18612..bc02281b1d7f1cf8341c042f69e41eaad8de0925 100644 (file)
@@ -319,4 +319,4 @@ def header_decode(s):
     the high level email.header class for that functionality.
     """
     s = s.replace('_', ' ')
-    return re.sub(r'=[a-fA-F0-9]{2}', _unquote_match, s, re.ASCII)
+    return re.sub(r'=[a-fA-F0-9]{2}', _unquote_match, s, flags=re.ASCII)
index 78b86b8630d52a800391b82fd440b23c5413d029..8757924522717d5a2817e0871223e0a098c7e319 100644 (file)
@@ -4048,6 +4048,10 @@ class TestQuopri(unittest.TestCase):
     def test_header_decode_non_ascii(self):
         self._test_header_decode('hello=C7there', 'hello\xc7there')
 
+    def test_header_decode_re_bug_18380(self):
+        # Issue 18380: Call re.sub with a positional argument for flags in the wrong position
+        self.assertEqual(quoprimime.header_decode('=30' * 257), '0' * 257)
+
     def _test_decode(self, encoded, expected_decoded, eol=None):
         if eol is None:
             decoded = quoprimime.decode(encoded)
index 71402b71ac1b45b180e58a07d0ffdc08a3fde15a..cf64ed2ea35e202bbe7898b5fba387119df6c4ac 100644 (file)
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -849,6 +849,7 @@ Alessandro Moura
 Pablo Mouzo
 Mher Movsisyan
 Ruslan Mstoi
+Valentina Mukhamedzhanova
 Michael Mulich
 Sape Mullender
 Sjoerd Mullender