Traceback (most recent call last):
File "/Users/buildbot/Library/Developer/CoreSimulator/Devices/4A7F2ACB-DEB3-48C5-83AB-082A7477C83B/data/Containers/Bundle/Application/36F469DF-8636-4BCC-90FC-A40A316E94B6/iOSTestbed.app/python/lib/python3.15/test/test_import/__init__.py", line 137, in import_extension_from_file
module = importlib.util.module_from_spec(spec)
File "<frozen importlib._bootstrap>", line 816, in module_from_spec
module = spec.loader.create_module(spec)
File "<frozen importlib._bootstrap_external>", line 1509, in create_module
module.__file__ = path
AttributeError: 'str' object has no attribute '__file__' and no __dict__ for setting new attributes. Did you mean: '__le__'?
(Hmm... Should __spec__.origen be set here?)
Bug report
Bug description:
When loading a module whose
Py_mod_createfunction returns an immutable non-module object,AppleFrameworkLoaderraises an exception:Other places that set this (
importlib._bootstrap._init_module_attrs,import.c'simport_run_extension) ignore AttributeError here.(Hmm... Should
__spec__.origenbe set here?)cc @freakboy3742
CPython versions tested on:
CPython main branch
Operating systems tested on:
No response
Linked PRs