summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_elementtree.c5
-rw-r--r--Modules/_threadmodule.c8
-rw-r--r--Modules/socketmodule.c12
3 files changed, 17 insertions, 8 deletions
diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c
index 62374d8..12e418d 100644
--- a/Modules/_elementtree.c
+++ b/Modules/_elementtree.c
@@ -352,7 +352,10 @@ get_attrib_from_keywords(PyObject *kwds)
return NULL;
}
attrib = PyDict_Copy(attrib);
- PyDict_DelItem(kwds, attrib_str);
+ if (attrib && PyDict_DelItem(kwds, attrib_str) < 0) {
+ Py_DECREF(attrib);
+ attrib = NULL;
+ }
} else {
attrib = PyDict_New();
}
diff --git a/Modules/_threadmodule.c b/Modules/_threadmodule.c
index d075ef7..aacce69 100644
--- a/Modules/_threadmodule.c
+++ b/Modules/_threadmodule.c
@@ -777,9 +777,11 @@ local_clear(localobject *self)
for(tstate = PyInterpreterState_ThreadHead(tstate->interp);
tstate;
tstate = PyThreadState_Next(tstate))
- if (tstate->dict &&
- PyDict_GetItem(tstate->dict, self->key))
- PyDict_DelItem(tstate->dict, self->key);
+ if (tstate->dict && PyDict_GetItem(tstate->dict, self->key)) {
+ if (PyDict_DelItem(tstate->dict, self->key)) {
+ PyErr_Clear();
+ }
+ }
}
return 0;
}
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index 40f1ca6..73d3e1a 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -362,10 +362,14 @@ remove_unusable_flags(PyObject *m)
else {
if (PyDict_GetItemString(
dict,
- win_runtime_flags[i].flag_name) != NULL) {
- PyDict_DelItemString(
- dict,
- win_runtime_flags[i].flag_name);
+ win_runtime_flags[i].flag_name) != NULL)
+ {
+ if (PyDict_DelItemString(
+ dict,
+ win_runtime_flags[i].flag_name))
+ {
+ PyErr_Clear();
+ }
}
}
}