summaryrefslogtreecommitdiff
path: root/Python/_warnings.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/_warnings.c')
-rw-r--r--Python/_warnings.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/Python/_warnings.c b/Python/_warnings.c
index 9ea81bbc6e..92378faa61 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;
}