Bug report
Bug description:
Documented behaviour: The encode_rfc2231 docstring states: "If neither charset nor language is given, then s is returned as-is."
Expected: The docstring promises 'a b' unchanged when charset and language are both None.
Actual: Returns 'a%20b'.
import email.utils
s = "a b"
if not s.isascii():
print("REFUTATION REJECTED: input is not ASCII")
else:
actual = email.utils.encode_rfc2231(s, charset=None, language=None)
expected = s # Documented return when neither argument is given.
if actual != expected:
print("REFUTATION CONFIRMED:", repr(s), repr(actual), repr(expected))
else:
print("REFUTATION REJECTED: actual matches documented expectation")
Output on Python 3.14.6 (Windows-11-10.0.26220-SP0), standard library email.utils:
REFUTATION CONFIRMED: 'a b' 'a%20b' 'a b'
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/email.utils-20261003-021105-c4
CPython versions tested on:
3.14
Operating systems tested on:
Windows
Bug report
Bug description:
Documented behaviour: The encode_rfc2231 docstring states: "If neither charset nor language is given, then s is returned as-is."
Expected: The docstring promises 'a b' unchanged when charset and language are both None.
Actual: Returns 'a%20b'.
Output on Python 3.14.6 (Windows-11-10.0.26220-SP0), standard library
email.utils: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/email.utils-20261003-021105-c4
CPython versions tested on:
3.14
Operating systems tested on:
Windows