You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
import ctypes sometimes fails when subinterpreters import it in parallel #163231
Importing ctypes in several subinterpreters at the same time, each in its own thread, sometimes fails with an AttributeError about a missing _type_ attribute.
Running this script often fails, though not every time. With ThreadPoolExecutor(1), so only one subinterpreter imports at a time, it doesn't fail.
Example error:
Traceback (most recent call last):
File "<script>", line 1, in <module>
File ".../lib/python3.15/ctypes/__init__.py", line 235, in <module>
class c_ubyte(_SimpleCData):
_type_ = "B"
AttributeError: class must define a '_type_' attribute which must be
one of these characters: 'cbBhHiIlLdfuzZqQPOv?g',
or one of these strings: 'Zf', 'Zd', 'Zg'.
I encounter the issue on Linux. It didn't fail on macOS in 5 runs.
Activity
picnixz commentedon Dec 6, 2026
cc @ZeroIntensity