Bug report
Bug description:
Documented behaviour: BaseHeader documentation in email.headerregistry: "Defects should be added to the list instead. The standard header parsers register defects for RFC compliance issues, for obsolete RFC syntax, and for unrecoverable parsing errors."
Expected: The Subject header's defects includes InvalidBase64PaddingDefect.
Actual: The parser's all_defects includes InvalidBase64PaddingDefect, but the Subject header's defects does not.
from email.headerregistry import HeaderRegistry, UnstructuredHeader
from email.errors import InvalidBase64PaddingDefect
value = '=?utf-8?b?YQ?='
if not value.isascii() or '\r' in value or '\n' in value:
print('REFUTATION REJECTED: input is not unfolded ASCII')
else:
expected = any(isinstance(d, InvalidBase64PaddingDefect)
for d in UnstructuredHeader.value_parser(value).all_defects)
actual = any(isinstance(d, InvalidBase64PaddingDefect)
for d in HeaderRegistry()('Subject', value).defects)
if expected and not actual:
print('REFUTATION CONFIRMED:', repr(value),
'actual:', actual, 'expected:', expected)
else:
print('REFUTATION REJECTED: parser prerequisite absent or defect preserved',
repr(value), 'actual:', actual, 'expected:', expected)
Output on Python 3.14.6 (Windows-11-10.0.26220-SP0), standard library email.headerregistry:
REFUTATION CONFIRMED: '=?utf-8?b?YQ?=' actual: False expected: 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-021509-c2
CPython versions tested on:
3.14
Operating systems tested on:
Windows
Bug report
Bug description:
Documented behaviour: BaseHeader documentation in email.headerregistry: "Defects should be added to the list instead. The standard header parsers register defects for RFC compliance issues, for obsolete RFC syntax, and for unrecoverable parsing errors."
Expected: The Subject header's defects includes InvalidBase64PaddingDefect.
Actual: The parser's all_defects includes InvalidBase64PaddingDefect, but the Subject header's defects does not.
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-021509-c2
CPython versions tested on:
3.14
Operating systems tested on:
Windows