summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-11-13 19:40:18 (GMT)
committerGitHub <noreply@github.com>2022-11-13 19:40:18 (GMT)
commit14c13955c59c15bd58520241ce64e27c68028d64 (patch)
tree3b74a1fdfb0aa0beaf2aab66f37fd536aac5efec /Modules
parent5324893599bcdab7e8d56fbc6dce32b994f76443 (diff)
downloadcpython-14c13955c59c15bd58520241ce64e27c68028d64.zip
cpython-14c13955c59c15bd58520241ce64e27c68028d64.tar.gz
cpython-14c13955c59c15bd58520241ce64e27c68028d64.tar.bz2
gh-99275: Fix `SystemError` in `ctypes` during `__initsubclass__` (GH-99283)
(cherry picked from commit 343eb0f94b26f2a4c1c15505d417e8157ec19660) Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_ctypes/stgdict.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Modules/_ctypes/stgdict.c b/Modules/_ctypes/stgdict.c
index 747339d..f9811ac 100644
--- a/Modules/_ctypes/stgdict.c
+++ b/Modules/_ctypes/stgdict.c
@@ -420,8 +420,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. */