summaryrefslogtreecommitdiffstats
path: root/Modules/_threadmodule.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2023-11-27 17:46:43 (GMT)
committerGitHub <noreply@github.com>2023-11-27 17:46:43 (GMT)
commitef9b2fc9b0378aee87328fadce73b3fefb6aca4a (patch)
tree8b9f8762518d48d544e04ddec57711fe647de9f5 /Modules/_threadmodule.c
parent0f009033202b339375944f613aa6d0597a2841de (diff)
downloadcpython-ef9b2fc9b0378aee87328fadce73b3fefb6aca4a.zip
cpython-ef9b2fc9b0378aee87328fadce73b3fefb6aca4a.tar.gz
cpython-ef9b2fc9b0378aee87328fadce73b3fefb6aca4a.tar.bz2
gh-111789: Use PyDict_GetItemRef() in Modules/_threadmodule.c (gh-112077)
Diffstat (limited to 'Modules/_threadmodule.c')
-rw-r--r--Modules/_threadmodule.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/Modules/_threadmodule.c b/Modules/_threadmodule.c
index c608789..afcf646 100644
--- a/Modules/_threadmodule.c
+++ b/Modules/_threadmodule.c
@@ -1115,12 +1115,10 @@ local_getattro(localobject *self, PyObject *name)
}
/* Optimization: just look in dict ourselves */
- PyObject *value = PyDict_GetItemWithError(ldict, name);
- if (value != NULL) {
- return Py_NewRef(value);
- }
- if (PyErr_Occurred()) {
- return NULL;
+ PyObject *value;
+ if (PyDict_GetItemRef(ldict, name, &value) != 0) {
+ // found or error
+ return value;
}
/* Fall back on generic to get __class__ and __dict__ */