diff --git a/Python/importdl.c b/Python/importdl.c index 23a55c39677100..10a497fa1ba157 100644 --- a/Python/importdl.c +++ b/Python/importdl.c @@ -413,6 +413,8 @@ _PyImport_GetModuleExportHooks( if (exportfunc) { *modexport = (PyModExportFunction)exportfunc; return 2; + } else if (PyErr_Occurred()) { + PyErr_Clear(); } exportfunc = findfuncptr(