summaryrefslogtreecommitdiffstats
path: root/Python/pylifecycle.c
diff options
context:
space:
mode:
authorStefan Krah <skrah@bytereef.org>2019-03-25 20:50:58 (GMT)
committerGitHub <noreply@github.com>2019-03-25 20:50:58 (GMT)
commit027b09c5a13aac9e14a3b43bb385298d549c3833 (patch)
tree44c35e9ec4e1ae42dde580a0ea369e5a1c32de1a /Python/pylifecycle.c
parentd1e768a67707bf7bb426c1537e1a764e89eaff78 (diff)
downloadcpython-027b09c5a13aac9e14a3b43bb385298d549c3833.zip
cpython-027b09c5a13aac9e14a3b43bb385298d549c3833.tar.gz
cpython-027b09c5a13aac9e14a3b43bb385298d549c3833.tar.bz2
bpo-36370: Check for PyErr_Occurred() after PyImport_GetModule() (GH-12504)
Diffstat (limited to 'Python/pylifecycle.c')
-rw-r--r--Python/pylifecycle.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
index 66cadc9..e08f290 100644
--- a/Python/pylifecycle.c
+++ b/Python/pylifecycle.c
@@ -2157,8 +2157,10 @@ wait_for_thread_shutdown(void)
PyObject *result;
PyObject *threading = _PyImport_GetModuleId(&PyId_threading);
if (threading == NULL) {
- /* threading not imported */
- PyErr_Clear();
+ if (PyErr_Occurred()) {
+ PyErr_WriteUnraisable(NULL);
+ }
+ /* else: threading not imported */
return;
}
result = _PyObject_CallMethodId(threading, &PyId__shutdown, NULL);