Skip to content

Commit 3416e7c

Browse files
authored
gh-140633: AppleFrameworkLoader: Ignore AttributeError when setting __file__ (GH-140635)
1 parent 7d70a14 commit 3416e7c

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

Lib/importlib/_bootstrap_external.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1506,7 +1506,13 @@ def create_module(self, spec):
15061506
)
15071507

15081508
# Ensure that the __file__ points at the .fwork location
1509-
module.__file__ = path
1509+
try:
1510+
module.__file__ = path
1511+
except AttributeError:
1512+
# Not important enough to report.
1513+
# (The error is also ignored in _bootstrap._init_module_attrs or
1514+
# import_run_extension in import.c)
1515+
pass
15101516

15111517
return module
15121518

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Ignore :exc:`AttributeError` when setting a module's ``__file__`` attribute
2+
when loading an extension module packaged as Apple Framework.

0 commit comments

Comments
 (0)