summaryrefslogtreecommitdiffstats
path: root/Python/dynload_win.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/dynload_win.c')
-rw-r--r--Python/dynload_win.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/Python/dynload_win.c b/Python/dynload_win.c
index edb6038..ffcf0ee 100644
--- a/Python/dynload_win.c
+++ b/Python/dynload_win.c
@@ -262,8 +262,9 @@ dl_funcptr _PyImport_GetDynLoadWindows(const char *shortname,
theLength));
}
if (message != NULL) {
- PyErr_SetImportError(message, PyUnicode_FromString(shortname),
- pathname);
+ PyObject *shortname_obj = PyUnicode_FromString(shortname);
+ PyErr_SetImportError(message, shortname_obj, pathname);
+ Py_XDECREF(shortname_obj);
Py_DECREF(message);
}
return NULL;