10000 gh-111789: Use PyDict_GetItemRef() in Modules/_threadmodule.c (gh-112… · python/cpython@ef9b2fc · GitHub
[go: up one dir, main page]

Skip to content

Commit ef9b2fc

Browse files
gh-111789: Use PyDict_GetItemRef() in Modules/_threadmodule.c (gh-112077)
1 parent 0f00903 commit ef9b2fc

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

Modules/_threadmodule.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1115,12 +1115,10 @@ local_getattro(localobject *self, PyObject *name)
11151115
}
11161116

11171117
/* Optimization: just look in dict ourselves */
1118-
PyObject *value = PyDict_GetItemWithError(ldict, name);
1119-
if (value != NULL) {
1120-
return Py_NewRef(value);
1121-
}
1122-
if (PyErr_Occurred()) {
1123-
return NULL;
1118+
PyObject *value;
1119+
if (PyDict_GetItemRef(ldict, name, &value) != 0) {
1120+
// found or error
1121+
return value;
11241122
}
11251123

11261124
/* Fall back on generic to get __class__ and __dict__ */

0 commit comments

Comments
 (0)
0