Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
Closed as not planned
Closed as not planned
Copy link
Labels
extension-modulesC modules in the Modules dirC modules in the Modules dirpendingThe issue will be closed if no feedback is providedThe issue will be closed if no feedback is providedtopic-subinterpreterstype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
When importing certain modules (zoneinfo is an example), attributes are missing when inside a sub interpreter.
Importing these modules works inside the main interpreter.
I've written a test to demonstrate the bug
importunittestimport_xxsubinterpretersasinterpretersclassTestCapsule(unittest.TestCase): deftest_capsule(self): importzoneinfodeftest_capsule_in_sub_interpreter(self): interp=interpreters.create() interpreters.run_string(interp, "import zoneinfo").Traceback (most recent call last): File "<string>", line 1, in <module> File "/usr/local/lib/python3.13/zoneinfo/__init__.py", line 14, in <module> from _zoneinfo import ZoneInfo AttributeError: module 'datetime' has no attribute 'datetime_CAPI' E ====================================================================== ERROR: test_capsule_in_sub_interpreter (test_capsule.TestCapsule.test_capsule_in_sub_interpreter) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/anthonyshaw/projects/subinterpreter-web/test_capsule.py", line 12, in test_capsule_in_sub_interpreter interpreters.run_string(interp, "import zoneinfo") _xxsubinterpreters.RunFailedError: AttributeError: module 'datetime' has no attribute 'datetime_CAPI' ---------------------------------------------------------------------- Ran 2 tests in 0.457s FAILED (errors=1) I haven't seen this behaviour on any other modules, the thing that seemed special with datetime and this attribute is that it is a PyCapsule. So the issue is likely related to that?
CPython versions tested on:
3.13, CPython main branch
Operating systems tested on:
macOS
Linked PRs
Metadata
Metadata
Assignees
Labels
extension-modulesC modules in the Modules dirC modules in the Modules dirpendingThe issue will be closed if no feedback is providedThe issue will be closed if no feedback is providedtopic-subinterpreterstype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Projects
Status
Done