summaryrefslogtreecommitdiff
path: root/Modules/_threadmodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/_threadmodule.c')
-rw-r--r--Modules/_threadmodule.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/Modules/_threadmodule.c b/Modules/_threadmodule.c
index aacce698e4..73babaf9ca 100644
--- a/Modules/_threadmodule.c
+++ b/Modules/_threadmodule.c
@@ -814,8 +814,11 @@ _ldict(localobject *self)
return NULL;
}
- dummy = PyDict_GetItem(tdict, self->key);
+ dummy = PyDict_GetItemWithError(tdict, self->key);
if (dummy == NULL) {
+ if (PyErr_Occurred()) {
+ return NULL;
+ }
ldict = _local_create_dummy(self);
if (ldict == NULL)
return NULL;
@@ -931,14 +934,17 @@ local_getattro(localobject *self, PyObject *name)
(PyObject *)self, name, ldict, 0);
/* Optimization: just look in dict ourselves */
- value = PyDict_GetItem(ldict, name);
- if (value == NULL)
- /* Fall back on generic to get __class__ and __dict__ */
- return _PyObject_GenericGetAttrWithDict(
- (PyObject *)self, name, ldict, 0);
-
- Py_INCREF(value);
- return value;
+ value = PyDict_GetItemWithError(ldict, name);
+ if (value != NULL) {
+ Py_INCREF(value);
+ return value;
+ }
+ else if (PyErr_Occurred()) {
+ return NULL;
+ }
+ /* Fall back on generic to get __class__ and __dict__ */
+ return _PyObject_GenericGetAttrWithDict(
+ (PyObject *)self, name, ldict, 0);
}
/* Called when a dummy is destroyed. */
@@ -958,7 +964,7 @@ _localdummy_destroyed(PyObject *localweakref, PyObject *dummyweakref)
self = (localobject *) obj;
if (self->dummies != NULL) {
PyObject *ldict;
- ldict = PyDict_GetItem(self->dummies, dummyweakref);
+ ldict = PyDict_GetItemWithError(self->dummies, dummyweakref);
if (ldict != NULL) {
PyDict_DelItem(self->dummies, dummyweakref);
}