Fix TypeError when dist.metadata returns None on Python 3.15#537
Closed
Fridayai700 wants to merge 1 commit intotox-dev:mainfrom
Closed
Fix TypeError when dist.metadata returns None on Python 3.15#537Fridayai700 wants to merge 1 commit intotox-dev:mainfrom
Fridayai700 wants to merge 1 commit intotox-dev:mainfrom
Conversation
In Python 3.15, importlib.metadata changed behavior: the metadata property returns None for missing/empty METADATA files instead of an empty PackageMetadata object. Guard has_valid_metadata() with a None check to handle both behaviors. Fixes tox-dev#530
Collaborator
|
I currently believe that the changes made to |
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.
Summary
Fixes
TypeError: argument of type 'NoneType' is not a container or iterableon Python 3.15, wheredist.metadatareturnsNonefor missing/empty METADATA files instead of an emptyPackageMetadataobject.Fixes #530
Changes
has_valid_metadata(): addeddist.metadata is not Noneguard before the"Name" in dist.metadatachecktest_has_valid_metadata_noneregression test using a mock dist withmetadata=NoneTest plan
has_valid_metadatareturns False whendist.metadatais Nonetest_invalid_metadatacontinues to pass