[3.13] gh-145376: Fix various reference leaks (GH-145377) (#148661)

(cherry picked from commit bd13cc09fa)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
This commit is contained in:
Stan Ulbrych 2026-05-12 19:35:27 +01:00 committed by GitHub
parent a2864ec643
commit ea8c3e028b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 4 additions and 1 deletions

View file

@ -1150,6 +1150,7 @@ _PyErr_Display(PyObject *file, PyObject *unused, PyObject *value, PyObject *tb)
if (print_exception_fn == NULL || !PyCallable_Check(print_exception_fn)) {
Py_DECREF(traceback_module);
Py_XDECREF(print_exception_fn);
goto fallback;
}

View file

@ -1782,7 +1782,7 @@ sys_getwindowsversion_impl(PyObject *module)
PyObject *realVersion = _sys_getwindowsversion_from_kernel32();
if (!realVersion) {
if (!PyErr_ExceptionMatches(PyExc_WindowsError)) {
return NULL;
goto error;
}
PyErr_Clear();