[Python-checkins] bpo-39831: Fix a reference leak in PyErr_WarnEx(). (GH-18750)
Serhiy Storchaka
webhook-mailer at python.org
Mon Mar 2 15:05:13 EST 2020
https://github.com/python/cpython/commit/2d2f85517f8216146a2f888d1ad4d765b3be2339
commit: 2d2f85517f8216146a2f888d1ad4d765b3be2339
branch: master
author: Serhiy Storchaka <storchaka at gmail.com>
committer: GitHub <noreply at github.com>
date: 2020-03-02T22:05:08+02:00
summary:
bpo-39831: Fix a reference leak in PyErr_WarnEx(). (GH-18750)
files:
M Python/_warnings.c
diff --git a/Python/_warnings.c b/Python/_warnings.c
index 9ea81bbc6e65f..92378faa61f3e 100644
--- a/Python/_warnings.c
+++ b/Python/_warnings.c
@@ -859,11 +859,11 @@ setup_context(Py_ssize_t stack_level, PyObject **filename, int *lineno,
int rc;
if (PyErr_Occurred()) {
- return 0;
+ goto handle_error;
}
*registry = PyDict_New();
if (*registry == NULL)
- return 0;
+ goto handle_error;
rc = _PyDict_SetItemId(globals, &PyId___warningregistry__, *registry);
if (rc < 0)
@@ -893,6 +893,7 @@ setup_context(Py_ssize_t stack_level, PyObject **filename, int *lineno,
dangling reference. */
Py_XDECREF(*registry);
Py_XDECREF(*module);
+ Py_XDECREF(*filename);
return 0;
}
More information about the Python-checkins
mailing list