mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
bpo-39831: Fix a reference leak in PyErr_WarnEx(). (GH-18750)
This commit is contained in:
parent
89aa4694fc
commit
2d2f85517f
1 changed files with 3 additions and 2 deletions
|
@ -859,11 +859,11 @@ setup_context(Py_ssize_t stack_level, PyObject **filename, int *lineno,
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
if (PyErr_Occurred()) {
|
if (PyErr_Occurred()) {
|
||||||
return 0;
|
goto handle_error;
|
||||||
}
|
}
|
||||||
*registry = PyDict_New();
|
*registry = PyDict_New();
|
||||||
if (*registry == NULL)
|
if (*registry == NULL)
|
||||||
return 0;
|
goto handle_error;
|
||||||
|
|
||||||
rc = _PyDict_SetItemId(globals, &PyId___warningregistry__, *registry);
|
rc = _PyDict_SetItemId(globals, &PyId___warningregistry__, *registry);
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
|
@ -893,6 +893,7 @@ setup_context(Py_ssize_t stack_level, PyObject **filename, int *lineno,
|
||||||
dangling reference. */
|
dangling reference. */
|
||||||
Py_XDECREF(*registry);
|
Py_XDECREF(*registry);
|
||||||
Py_XDECREF(*module);
|
Py_XDECREF(*module);
|
||||||
|
Py_XDECREF(*filename);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue