https://github.com/python/cpython/commit/0e3b47b839f40238bdb693c00cc24913c0acc87f commit: 0e3b47b839f40238bdb693c00cc24913c0acc87f branch: 3.13 author: Miss Islington (bot) <[email protected]> committer: encukou <[email protected]> date: 2025-10-27T14:08:09+01:00 summary:
[3.13] gh-140633: AppleFrameworkLoader: Ignore AttributeError when setting __file__ (GH-140635) (GH-140659) (cherry picked from commit 3416e7c8dc004773d814b6f9ec9562434ed961cd) Co-authored-by: Petr Viktorin <[email protected]> files: A Misc/NEWS.d/next/Library/2025-10-26-16-24-12.gh-issue-140633.ioayC1.rst M Lib/importlib/_bootstrap_external.py diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py index c5e641773e6c5e..ad9a1a391a4b40 100644 --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -1762,7 +1762,13 @@ def create_module(self, spec): ) # Ensure that the __file__ points at the .fwork location - module.__file__ = path + try: + module.__file__ = path + except AttributeError: + # Not important enough to report. + # (The error is also ignored in _bootstrap._init_module_attrs or + # import_run_extension in import.c) + pass return module diff --git a/Misc/NEWS.d/next/Library/2025-10-26-16-24-12.gh-issue-140633.ioayC1.rst b/Misc/NEWS.d/next/Library/2025-10-26-16-24-12.gh-issue-140633.ioayC1.rst new file mode 100644 index 00000000000000..9675a5d427a0d9 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2025-10-26-16-24-12.gh-issue-140633.ioayC1.rst @@ -0,0 +1,2 @@ +Ignore :exc:`AttributeError` when setting a module's ``__file__`` attribute +when loading an extension module packaged as Apple Framework. _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]
