msg218618 - (view) |
Author: Paul Sokolovsky (pfalcon) * |
Date: 2014-05-15 16:37 |
Lib/quopri.py for version 3.3..3.5-tip contains following code: ESCAPE = b'=' ... line = input.readline() if not line: break i, n = 0, len(line) if n > 0 and line[n-1:n] == b'\n': ... elif i+1 < n and line[i+1] == ESCAPE: So, ESCAPE is defined as bytes, we see that "line" is read as bytes, and characters are accessed using idiom like "line[n-1:n]", but then it uses "line[i+1]", which returns int and thus will never be equal to ESCAPE. I'm not sure what exact semantic condition that branch represents, for me it looks like "==" sequence to be decoded as "=". But I don't see such encoding variant in http://en.wikipedia.org/wiki/Quoted-printable . Either way, replacing that condition with "and False", still passes test_quopri.py |
|
|
msg218678 - (view) |
Author: Terry J. Reedy (terry.reedy) *  |
Date: 2014-05-16 19:16 |
Senthil, David, I hope one of you understands this. I looks like a minor fix. |
|
|
msg218679 - (view) |
Author: R. David Murray (r.david.murray) *  |
Date: 2014-05-16 19:22 |
We should resolve issue 18022 before we decide how to "fix" this. |
|
|
msg218680 - (view) |
Author: Paul Sokolovsky (pfalcon) * |
Date: 2014-05-16 19:49 |
This is minor issue indeed, uncovered when trying to run quopri.py with MicroPython http://micropython.org . I now worked around this on MicroPython side, but otherwise I set to report any issues I've seen with MicroPython porting, in the hope that MicroPython effort is good member of Python community. If the original report is unclear, feel free to point to any vague spots, and I'll elaborate on it. Thanks. |
|
|
msg218681 - (view) |
Author: R. David Murray (r.david.murray) *  |
Date: 2014-05-16 20:05 |
Thanks. It's very clear. What isn't clear is if the line should be made to work as apparently intended, or removed :) (My guess at this point without re-reading the RFCs is that it should be removed.) |
|
|
msg239095 - (view) |
Author: Martin Panter (martin.panter) *  |
Date: 2015-03-24 08:00 |
The implementation has been fixed for Issue 23681 to slice instead of index, and now compares byte strings: >>> import quopri >>> quopri.decodestring(b"123==four") b'123=four' >>> quopri.a2b_qp = None >>> quopri.decodestring(b"123==four") b'123=four' However, I think a test still needs to be written to cover this branch of the code. |
|
|
msg240496 - (view) |
Author: Guido van Rossum (gvanrossum) *  |
Date: 2015-04-11 21:39 |
Here's a unittest by Christie Wilson for this issue. |
|
|
msg240497 - (view) |
Author: Roundup Robot (python-dev)  |
Date: 2015-04-11 21:46 |
New changeset 2582962ccf17 by Guido van Rossum in branch '3.4': Unittest for Issue 21511 by Christie Wilson bobcatfish@gmail.com. https://hg.python.org/cpython/rev/2582962ccf17 New changeset 23d37a147051 by Guido van Rossum in branch 'default': Unittest for Issue 21511 by Christie Wilson bobcatfish@gmail.com (merge from 3.4). https://hg.python.org/cpython/rev/23d37a147051 |
|
|
msg240499 - (view) |
Author: Guido van Rossum (gvanrossum) *  |
Date: 2015-04-11 21:48 |
Fixed, and removing the dependency on issue 18022. Thanks Christie! |
|
|