Skip to content

Commit 0e3b47b

Browse files
[3.13] gh-140633: AppleFrameworkLoader: Ignore AttributeError when setting __file__ (GH-140635) (GH-140659)
(cherry picked from commit 3416e7c) Co-authored-by: Petr Viktorin <[email protected]>
1 parent 134e2f8 commit 0e3b47b

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
@@ -1762,7 +1762,13 @@ def create_module(self, spec):
17621762
)
17631763

17641764
# Ensure that the __file__ points at the .fwork location
1765-
module.__file__ = path
1765+
try:
1766+
module.__file__ = path
1767+
except AttributeError:
1768+
# Not important enough to report.
1769+
# (The error is also ignored in _bootstrap._init_module_attrs or
1770+
# import_run_extension in import.c)
1771+
pass
17661772

17671773
return module
17681774

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)