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
No exception set but raise SystemError when setting _fields_ of ctypes.Structure in __init_subclass__ #99275
No exception set but raise SystemError when setting _fields_ of ctypes.Structure in __init_subclass__
Reproduce code:
import ctypes
class ParentStructure(ctypes.Structure):
def __init_subclass__(cls, **kwargs):
cls._fields_ =[('v1',ctypes.c_uint),('v2',ctypes.c_uint),]
super().__init_subclass__(**kwargs)
class ChildStructure(ParentStructure):
pass
Output Exception
Traceback (most recent call last):
File "D:\Projects\pythonProject\main.py", line 10, in <module>
class ChildStructure(ParentStructure):
File "D:\Projects\pythonProject\main.py", line 6, in __init_subclass__
cls._fields_ =[('v1',ctypes.c_uint),('v2',ctypes.c_uint),]
SystemError: error return without exception set
Your environment
Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug 1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)] on win32
Activity
pythongh-99275: Fix `SystemError` in `ctypes` during `__initsubclass__`
sobolevn commentedon Nov 9, 2022
I proposed a PR that sets the exception.
pythongh-99275: [ctypes] remove `_use_broken_old_ctypes_structure_sem…
pythongh-99275: [ctypes] remove `_use_broken_old_ctypes_structure_sem…
pythongh-99275: [ctypes] remove `_use_broken_old_ctypes_structure_sem…
gh-99275: Fix `SystemError` in `ctypes` during `__initsubclass__` (#9…
pythongh-99275: Fix `SystemError` in `ctypes` during `__initsubclass_…
pythongh-99275: Fix `SystemError` in `ctypes` during `__initsubclass_…
gh-99275: Fix `SystemError` in `ctypes` during `__initsubclass__` (GH…
gh-99275: Fix `SystemError` in `ctypes` during `__initsubclass__` (GH…
encukou commentedon Sep 18, 2024
Thanks for the fix! I'll close the issue.