[New-bugs-announce] [issue21511] Thinko in Lib/quopri.py

Paul Sokolovsky report at bugs.python.org
Thu May 15 18:37:35 CEST 2014


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 <report at bugs.python.org>
<http://bugs.python.org/issue21511>
_______________________________________


More information about the New-bugs-announce mailing list