Bug report
Bug description:
Documented behaviour: The quopri.encode docstring promises: "Read 'input', apply quoted-printable encoding, and write to 'output'." The module docstring identifies the format as "quoted-printable transport encoding as per RFC 1521." Quoted-printable hexadecimal escapes must remain intact across soft line breaks.
Expected: Valid quoted-printable output that decodes to 74 ASCII A bytes followed by byte 0xff, with the =FF escape kept intact.
Actual: The output is 74 ASCII A bytes followed by b'==\nFF'; decoding yields those A bytes followed by b'=\nFF' instead of byte 0xff.
import binascii, io, quopri
s = b'A' * 74 + b'\xff'
if not isinstance(s, bytes) or b'\r' in s or b'\n' in s:
print('REFUTATION REJECTED:', 'input is not a newline-free bytes payload')
else:
quopri.b2a_qp = None
out = io.BytesIO()
quopri.encode(io.BytesIO(s), out, quotetabs=True, header=False)
encoded = out.getvalue()
actual = binascii.a2b_qp(encoded)
expected = s
if actual != expected:
print('REFUTATION CONFIRMED:', s, (encoded, actual), expected)
else:
print('REFUTATION REJECTED:', 'independent decoding recovers the input')
Output on Python 3.14.6 (Windows-11-10.0.26220-SP0), standard library quopri:
REFUTATION CONFIRMED: b'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\xff' (b'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==\nFF', b'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=\nFF') b'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\xff'
This report was found and written by an automated property-testing tool I run (bugforge). The reproducer above was executed and its output is pasted unedited; no person reviewed the report before it was filed. The search script is in https://github.com/augusto-rehfeldt/bugforge-results/tree/main/quopri-20261003-042505-c1
CPython versions tested on:
3.14
Operating systems tested on:
Windows
Bug report
Bug description:
Documented behaviour: The quopri.encode docstring promises: "Read 'input', apply quoted-printable encoding, and write to 'output'." The module docstring identifies the format as "quoted-printable transport encoding as per RFC 1521." Quoted-printable hexadecimal escapes must remain intact across soft line breaks.
Expected: Valid quoted-printable output that decodes to 74 ASCII A bytes followed by byte 0xff, with the =FF escape kept intact.
Actual: The output is 74 ASCII A bytes followed by b'==\nFF'; decoding yields those A bytes followed by b'=\nFF' instead of byte 0xff.
Output on Python 3.14.6 (Windows-11-10.0.26220-SP0), standard library
quopri:This report was found and written by an automated property-testing tool I run (bugforge). The reproducer above was executed and its output is pasted unedited; no person reviewed the report before it was filed. The search script is in https://github.com/augusto-rehfeldt/bugforge-results/tree/main/quopri-20261003-042505-c1
CPython versions tested on:
3.14
Operating systems tested on:
Windows