summaryrefslogtreecommitdiffstats
path: root/Python/import.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2018-12-11 07:27:50 (GMT)
committerGitHub <noreply@github.com>2018-12-11 07:27:50 (GMT)
commit8855d9339858683c9b4fcd50b02a7bca526d4726 (patch)
tree3c85fc696f92556807f1031f9653ed3b73d70561 /Python/import.c
parent37607f26697351751165a042f91f04530ce333f7 (diff)
downloadcpython-8855d9339858683c9b4fcd50b02a7bca526d4726.zip
cpython-8855d9339858683c9b4fcd50b02a7bca526d4726.tar.gz
cpython-8855d9339858683c9b4fcd50b02a7bca526d4726.tar.bz2
[3.6] bpo-35454: Fix miscellaneous minor issues in error handling. (GH-11077) (GH-11106)
(cherry picked from commit 8905fcc85a6fc3ac394bc89b0bbf40897e9497a6)
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 db1650a..cb19270 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -1973,10 +1973,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;
}