Skip to content

Commit 87afee2

Browse files
[3.14] gh-140633: AppleFrameworkLoader: Ignore AttributeError when setting __file__ (GH-140635) (GH-140660)
(cherry picked from commit 3416e7c) Co-authored-by: Petr Viktorin <[email protected]>
1 parent 5ae4612 commit 87afee2

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
@@ -1498,7 +1498,13 @@ def create_module(self, spec):
14981498
)
14991499

15001500
# Ensure that the __file__ points at the .fwork location
1501-
module.__file__ = path
1501+
try:
1502+
module.__file__ = path
1503+
except AttributeError:
1504+
# Not important enough to report.
1505+
# (The error is also ignored in _bootstrap._init_module_attrs or
1506+
# import_run_extension in import.c)
1507+
pass
15021508

15031509
return module
15041510

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)