New submission from Paul Sokolovsky:
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
----------
components: Library (Lib)
messages: 218618
nosy: pfalcon
priority: normal
severity: normal
status: open
title: Thinko in Lib/quopri.py
type: behavior
versions: Python 3.5
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue21511>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com