[Python-checkins] [3.8] bpo-39831: Fix a reference leak in PyErr_WarnEx(). (GH-18750) (GH-18761)
Pablo Galindo
webhook-mailer at python.org
Mon Mar 2 20:13:18 EST 2020
https://github.com/python/cpython/commit/394dc0db878c08d003772de163a57ac12046d865
commit: 394dc0db878c08d003772de163a57ac12046d865
branch: 3.8
author: Pablo Galindo <Pablogsal at gmail.com>
committer: GitHub <noreply at github.com>
date: 2020-03-03T01:13:10Z
summary:
[3.8] bpo-39831: Fix a reference leak in PyErr_WarnEx(). (GH-18750) (GH-18761)
(cherry picked from commit 2d2f855)
Co-authored-by: Serhiy Storchaka <storchaka at gmail.com>
files:
M Python/_warnings.c
diff --git a/Python/_warnings.c b/Python/_warnings.c
index e02d28305126d..87269dd4dbc9e 100644
--- a/Python/_warnings.c
+++ b/Python/_warnings.c
@@ -856,11 +856,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)
@@ -890,6 +890,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