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.
diff --git a/Lib/test/test_binascii.py b/Lib/test/test_binascii.py
index 8df4504..8272ad9 100755
--- a/Lib/test/test_binascii.py
+++ b/Lib/test/test_binascii.py
@@ -134,7 +134,7 @@
pass
else:
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("=AX"), "=AX")
self.assertRaises(TypeError, binascii.b2a_qp, foo="bar")
diff --git a/Misc/NEWS b/Misc/NEWS
index 32cdb1f..8c93519 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -219,6 +219,10 @@
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.
+
- Bug #1567666: Emulate GetFileAttributesExA for Win95.
- Patch #1576166: Support os.utime for directories on Windows NT+.
diff --git a/Modules/binascii.c b/Modules/binascii.c
index 3b2c8b2..4dee451 100644
--- a/Modules/binascii.c
+++ b/Modules/binascii.c
@@ -1057,8 +1057,7 @@
in++;
if (in >= datalen) break;
/* Soft line breaks */
- if ((data[in] == '\n') || (data[in] == '\r') ||
- (data[in] == ' ') || (data[in] == '\t')) {
+ if ((data[in] == '\n') || (data[in] == '\r')) {
if (data[in] != '\n') {
while (in < datalen && data[in] != '\n') in++;
}