Bug report
Bug description:
Documented behaviour: quopri.decode documentation: "Decode the contents of the input file and write the resulting decoded binary data to the output file. input and output must be binary file objects." The io.RawIOBase.write documentation permits returning fewer bytes than supplied.
Expected: Output contains b'AB'.
Actual: decode returns normally, but output contains only b'A'.
import io
import quopri
s = b'AB'
limit = 1
class Output(io.RawIOBase):
def __init__(self):
super().__init__()
self.data = bytearray()
def writable(self):
return True
def write(self, b):
n = min(limit, len(b))
self.data.extend(b[:n])
return n
source, output = io.BytesIO(s), Output()
if not (s and all(65 <= c <= 90 or 97 <= c <= 122 for c in s)
and source.readable() and output.writable() and limit > 0):
print("REFUTATION REJECTED:", "invalid input or stream")
else:
expected = s # ASCII letters are literal quoted-printable data.
try:
quopri.decode(source, output)
except Exception as e:
print("REFUTATION REJECTED:", repr(e))
else:
actual = bytes(output.data)
if actual != expected:
print("REFUTATION CONFIRMED:", (s, limit), actual, expected)
else:
print("REFUTATION REJECTED:", "actual matches expected")
Output on Python 3.14.6 (Windows-11-10.0.26220-SP0), standard library quopri:
REFUTATION CONFIRMED: (b'AB', 1) b'A' b'AB'
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-110848-c2
CPython versions tested on:
3.14
Operating systems tested on:
Windows
Bug report
Bug description:
Documented behaviour: quopri.decode documentation: "Decode the contents of the input file and write the resulting decoded binary data to the output file. input and output must be binary file objects." The io.RawIOBase.write documentation permits returning fewer bytes than supplied.
Expected: Output contains b'AB'.
Actual: decode returns normally, but output contains only b'A'.
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-110848-c2
CPython versions tested on:
3.14
Operating systems tested on:
Windows