summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Misc/NEWS2
-rw-r--r--Python/dynload_win.c5
2 files changed, 5 insertions, 2 deletions
diff --git a/Misc/NEWS b/Misc/NEWS
index 58ae9ba469..a204bb3c12 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,8 @@ What's New in Python 3.3.3 release candidate 1?
Core and Builtins
-----------------
+- Issue #18180: Fix ref leak in _PyImport_GetDynLoadWindows().
+
- Issue #18038: SyntaxError raised during compilation sources with illegal
encoding now always contains an encoding name.
diff --git a/Python/dynload_win.c b/Python/dynload_win.c
index edb6038e3b..ffcf0ee1d7 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;