Bug report
Bug description:
Documented behaviour: BaseHeader's subclass parsing contract states: "The parser should not, insofar as practical, raise any errors. Defects should be added to the list instead." MIMEVersionHeader.value_parser documents the grammar as "mime-version = [CFWS] 1digit [CFWS] "." [CFWS] 1digit [CFWS]".
Expected: Return a MIMEVersionHeader with parsing defects for '².0'.
Actual: Raises ValueError: invalid literal for int() with base 10: '²'.
from email.headerregistry import HeaderRegistry
value = chr(0xB2) + ".0"
parts = value.split(".")
domain_ok = len(parts) == 2 and all(
p and all(c in "0123456789" or (c.isdigit() and not c.isdecimal()) for c in p)
for p in parts
)
if not domain_ok:
print("REFUTATION REJECTED: input is outside the claimed domain")
else:
# Invalid MIME grammar is parser input, not grounds for raising:
# BaseHeader requires reporting defects instead, insofar as practical.
grammar_ok = all(all(c in "0123456789" for c in p) for p in parts)
expected = {"returned_header": True, "has_defects": not grammar_ok}
try:
h = HeaderRegistry()("MIME-Version", value)
actual = {"returned_header": True, "has_defects": bool(h.defects)}
except Exception as e:
actual = {"returned_header": False, "exception": type(e).__name__,
"message": str(e)}
if actual != expected:
print("REFUTATION CONFIRMED:", repr(value), "actual:", actual,
"expected:", expected)
else:
print("REFUTATION REJECTED: behavior matches the documented expectation")
Output on Python 3.14.6 (Windows-11-10.0.26220-SP0), standard library email.headerregistry:
REFUTATION CONFIRMED: '².0' actual: {'returned_header': False, 'exception': 'ValueError', 'message': "invalid literal for int() with base 10: '²'"} expected: {'returned_header': True, 'has_defects': True}
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.headerregistry-20261003-134457-c2
CPython versions tested on:
3.14
Operating systems tested on:
Windows
Bug report
Bug description:
Documented behaviour: BaseHeader's subclass parsing contract states: "The parser should not, insofar as practical, raise any errors. Defects should be added to the list instead." MIMEVersionHeader.value_parser documents the grammar as "mime-version = [CFWS] 1digit [CFWS] "." [CFWS] 1digit [CFWS]".
Expected: Return a MIMEVersionHeader with parsing defects for '².0'.
Actual: Raises ValueError: invalid literal for int() with base 10: '²'.
Output on Python 3.14.6 (Windows-11-10.0.26220-SP0), standard library
email.headerregistry: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.headerregistry-20261003-134457-c2
CPython versions tested on:
3.14
Operating systems tested on:
Windows