Kaydet (Commit) dd3bffb6 authored tarafından Georg Brandl's avatar Georg Brandl

Bug #1588217: don't parse "= " as a soft line break in binascii's

a2b_qp() function, instead leave it in the string as quopri.decode()
does.
 (backport from rev. 52765)
üst 7563191c
...@@ -134,7 +134,7 @@ class BinASCIITest(unittest.TestCase): ...@@ -134,7 +134,7 @@ class BinASCIITest(unittest.TestCase):
pass pass
else: else:
self.fail("binascii.a2b_qp(**{1:1}) didn't raise TypeError") self.fail("binascii.a2b_qp(**{1:1}) didn't raise TypeError")
self.assertEqual(binascii.a2b_qp("= "), "") self.assertEqual(binascii.a2b_qp("= "), "= ")
self.assertEqual(binascii.a2b_qp("=="), "=") self.assertEqual(binascii.a2b_qp("=="), "=")
self.assertEqual(binascii.a2b_qp("=AX"), "=AX") self.assertEqual(binascii.a2b_qp("=AX"), "=AX")
self.assertRaises(TypeError, binascii.b2a_qp, foo="bar") self.assertRaises(TypeError, binascii.b2a_qp, foo="bar")
......
...@@ -70,6 +70,10 @@ Core and builtins ...@@ -70,6 +70,10 @@ Core and builtins
Extension Modules Extension Modules
----------------- -----------------
- Bug #1588217: don't parse "= " as a soft line break in binascii's
a2b_qp() function, instead leave it in the string as quopri.decode()
does.
- Patch #838546: Make terminal become controlling in pty.fork() - Patch #838546: Make terminal become controlling in pty.fork()
- Patch #1560695: Add .note.GNU-stack to ctypes' sysv.S so that - Patch #1560695: Add .note.GNU-stack to ctypes' sysv.S so that
......
...@@ -1057,8 +1057,7 @@ binascii_a2b_qp(PyObject *self, PyObject *args, PyObject *kwargs) ...@@ -1057,8 +1057,7 @@ binascii_a2b_qp(PyObject *self, PyObject *args, PyObject *kwargs)
in++; in++;
if (in >= datalen) break; if (in >= datalen) break;
/* Soft line breaks */ /* Soft line breaks */
if ((data[in] == '\n') || (data[in] == '\r') || if ((data[in] == '\n') || (data[in] == '\r')) {
(data[in] == ' ') || (data[in] == '\t')) {
if (data[in] != '\n') { if (data[in] != '\n') {
while (in < datalen && data[in] != '\n') in++; while (in < datalen && data[in] != '\n') in++;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment