From 62674f3a36ec55f86a5f20ee028a37fbd549bd6c Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Mon, 10 Dec 2018 23:05:13 -0800 Subject: bpo-35454: Fix miscellaneous minor issues in error handling. (GH-11077) * bpo-35454: Fix miscellaneous minor issues in error handling. * Fix a null pointer dereference. (cherry picked from commit 8905fcc85a6fc3ac394bc89b0bbf40897e9497a6) Co-authored-by: Serhiy Storchaka --- Modules/_threadmodule.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'Modules/_threadmodule.c') diff --git a/Modules/_threadmodule.c b/Modules/_threadmodule.c index 16d3191c62..2a6b8931d7 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; } -- cgit v1.2.1