diff options
author | Stefan Krah <skrah@bytereef.org> | 2019-03-25 20:50:58 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-25 20:50:58 (GMT) |
commit | 027b09c5a13aac9e14a3b43bb385298d549c3833 (patch) | |
tree | 44c35e9ec4e1ae42dde580a0ea369e5a1c32de1a /Python/pylifecycle.c | |
parent | d1e768a67707bf7bb426c1537e1a764e89eaff78 (diff) | |
download | cpython-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.c | 6 |
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); |