Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
revert PyDict_GetItemWithError change in cache_struct_converter
  • Loading branch information
chgnrdv committed Nov 14, 2023
commit 4beec33f3ca407e11ef93b8dceebdcca8839ccb0
10 changes: 6 additions & 4 deletions Modules/_struct.c
Original file line number Diff line number Diff line change
Expand Up @@ -2250,12 +2250,14 @@ cache_struct_converter(PyObject *module, PyObject *fmt, PyStructObject **ptr)
return 1;
}

if (PyDict_GetItemRef(state->cache, fmt, ptr) < 0) {
return 0;
}
if (*ptr != NULL) {
s_object = PyDict_GetItemWithError(state->cache, fmt);
if (s_object != NULL) {
*ptr = (PyStructObject *)Py_NewRef(s_object);
return Py_CLEANUP_SUPPORTED;
}
else if (PyErr_Occurred()) {
return 0;
}

s_object = PyObject_CallOneArg(state->PyStructType, fmt);
if (s_object != NULL) {
Expand Down