summaryrefslogtreecommitdiffstats
path: root/Python/import.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/import.c')
-rw-r--r--Python/import.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Python/import.c b/Python/import.c
index 15637c6..c4f0877 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -2143,10 +2143,10 @@ _imp_create_dynamic_impl(PyObject *module, PyObject *spec, PyObject *file)
}
mod = _PyImport_FindExtensionObject(name, path);
- if (mod != NULL) {
+ if (mod != NULL || PyErr_Occurred()) {
Py_DECREF(name);
Py_DECREF(path);
- Py_INCREF(mod);
+ Py_XINCREF(mod);
return mod;
}