summaryrefslogtreecommitdiff
path: root/Python/pylifecycle.c
diff options
context:
space:
mode:
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 66cadc99c7..e08f290d8d 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);