bpo-36370: Check for PyErr_Occurred() after PyImport_GetModule() (GH-12504)

This commit is contained in:
Stefan Krah 2019-03-25 21:50:58 +01:00 committed by GitHub
parent d1e768a677
commit 027b09c5a1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 11 deletions

View file

@ -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);