diff options
author | Nikita Sobolev <mail@sobolevn.me> | 2022-11-13 19:22:45 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-13 19:22:45 (GMT) |
commit | 343eb0f94b26f2a4c1c15505d417e8157ec19660 (patch) | |
tree | 7d0f28d4f922856a07575c1d4976a91b46ff9820 /Modules | |
parent | d329f859b9cea9e6fa76fdf03927f659cf17786b (diff) | |
download | cpython-343eb0f94b26f2a4c1c15505d417e8157ec19660.zip cpython-343eb0f94b26f2a4c1c15505d417e8157ec19660.tar.gz cpython-343eb0f94b26f2a4c1c15505d417e8157ec19660.tar.bz2 |
gh-99275: Fix `SystemError` in `ctypes` during `__initsubclass__` (#99283)
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_ctypes/stgdict.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Modules/_ctypes/stgdict.c b/Modules/_ctypes/stgdict.c index 1c69a29..9f031b0 100644 --- a/Modules/_ctypes/stgdict.c +++ b/Modules/_ctypes/stgdict.c @@ -424,8 +424,11 @@ PyCStructUnionType_update_stgdict(PyObject *type, PyObject *fields, int isStruct } stgdict = PyType_stgdict(type); - if (!stgdict) + if (!stgdict) { + PyErr_SetString(PyExc_TypeError, + "ctypes state is not initialized"); return -1; + } /* If this structure/union is already marked final we cannot assign _fields_ anymore. */ |