Repository navigation
Conversation
Use the core Metadata class as the field schema so that subclasses do not reject inherited fields or omit their headers when writing RFC822 metadata. Keep instance attribute access for validation and value retrieval. Cover both factories and both validation modes with subclass round trips. Assisted-by: OpenAI Codex
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A
Metadatasubclass currently rejects valid input through its inheritedfrom_raw()andfrom_email()methods: fields such asname,version, andrequires_distare reported as unrecognized because validation looks only in the subclass's own__dict__. Withvalidate=False,as_rfc822()instead silently drops all inherited headers, leaving only the description body.Use
Metadata.__dict__as the core field schema in both places. Values are still read throughgetattr()on the instance, preserving descriptor validation and subclass attribute overrides. The four regression cases cover both factories with validation enabled and disabled, and compare the complete serialized metadata with the base class output. All four fail onef837aad3127167671eb37b9f6bd8a94ec7ce26ebefore the fix.Validation on macOS:
python -m coverage run -m pytest -q— 62,496 passed, 1 glibc-only test skipped, 427 property tests deselected by the default configuration.python -m coverage report— 100% statement and branch coverage, includingmetadata.py.python -m pytest tests/test_metadata.py -q— 348 passed.nox -s lint— passed all hooks, type checks, sdist/wheel builds, and Twine checks.AI assistance: AI agents performed the investigation, generated the patch, regression tests, and PR text, and ran the checks above. A separate AI agent reproduced the bug, reviewed the final diff, reran the metadata tests, and reported no blockers in its automated review. The full supported interpreter/platform matrix has not been run locally.