mirror of
https://github.com/python/cpython.git
synced 2026-04-13 15:20:52 +00:00
gh-145376: Fix various reference leaks (GH-145377)
This commit is contained in:
parent
246227392c
commit
bd13cc09fa
6 changed files with 6 additions and 1 deletions
|
|
@ -609,6 +609,7 @@ check_missing___main___attr(PyObject *exc)
|
|||
// Get the error message.
|
||||
PyObject *args = PyException_GetArgs(exc);
|
||||
if (args == NULL || args == Py_None || PyObject_Size(args) < 1) {
|
||||
Py_XDECREF(args);
|
||||
assert(!PyErr_Occurred());
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5642,6 +5642,7 @@ _imp__set_lazy_attributes_impl(PyObject *module, PyObject *modobj,
|
|||
|
||||
module_dict = get_mod_dict(modobj);
|
||||
if (module_dict == NULL || !PyDict_CheckExact(module_dict)) {
|
||||
Py_DECREF(lazy_submodules);
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1145,6 +1145,7 @@ _PyErr_Display(PyObject *file, PyObject *unused, PyObject *value, PyObject *tb)
|
|||
"traceback",
|
||||
"_print_exception_bltin");
|
||||
if (print_exception_fn == NULL || !PyCallable_Check(print_exception_fn)) {
|
||||
Py_XDECREF(print_exception_fn);
|
||||
goto fallback;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1762,7 +1762,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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue