Skip to content

Commit 9d21467

Browse files
committed
Properly handle missing METADATA on Python 3.15+
See python/cpython#143387 Used LLM to analyze a CI test failure. Assisted-By: Claude Opus 4.6
1 parent eb1bf7b commit 9d21467

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎pythondistdeps.py‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,12 @@ def __init__(self, path):
7676

7777
# Check that the initialization went well and metadata are not missing or corrupted
7878
# name is the most important attribute, if it doesn't exist, import failed
79-
if not self.name or not isinstance(self.name, str):
79+
# Python 3.15+ raises MetadataNotFound (FileNotFoundError) instead of returning None
80+
try:
81+
name = self.name
82+
except FileNotFoundError:
83+
name = None
84+
if not name or not isinstance(name, str):
8085
print("*** PYTHON_METADATA_FAILED_TO_PARSE_ERROR___SEE_STDERR ***")
8186
print('Error: Python metadata at `{}` are missing or corrupted.'.format(path), file=stderr)
8287
exit(65) # os.EX_DATAERR

0 commit comments

Comments
 (0)