summaryrefslogtreecommitdiffstats
path: root/Modules/_struct.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/_struct.c')
-rw-r--r--Modules/_struct.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Modules/_struct.c b/Modules/_struct.c
index 5954c13..90839b2 100644
--- a/Modules/_struct.c
+++ b/Modules/_struct.c
@@ -2088,12 +2088,15 @@ cache_struct_converter(PyObject *fmt, PyStructObject **ptr)
return 0;
}
- s_object = PyDict_GetItem(cache, fmt);
+ s_object = PyDict_GetItemWithError(cache, fmt);
if (s_object != NULL) {
Py_INCREF(s_object);
*ptr = (PyStructObject *)s_object;
return Py_CLEANUP_SUPPORTED;
}
+ else if (PyErr_Occurred()) {
+ return 0;
+ }
s_object = PyObject_CallFunctionObjArgs((PyObject *)(&PyStructType), fmt, NULL);
if (s_object != NULL) {