Closed as not planned
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
import unittest
import _xxsubinterpreters as interpreters
class TestCapsule(unittest.TestCase):
def test_capsule(self):
import zoneinfo
def test_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
Projects
Status
Done