summaryrefslogtreecommitdiffstats
path: root/Python/pythonrun.c
diff options
context:
space:
mode:
authorPablo Galindo <Pablogsal@gmail.com>2021-03-29 23:24:17 (GMT)
committerGitHub <noreply@github.com>2021-03-29 23:24:17 (GMT)
commit2f01c562be913004e1d46fc02705c51b81638d67 (patch)
tree2ccd43c1a6d84259c9c001769e324f5804a1e100 /Python/pythonrun.c
parent7c2284f97d140c4e4a85382bfb3a42440be2464d (diff)
downloadcpython-2f01c562be913004e1d46fc02705c51b81638d67.zip
cpython-2f01c562be913004e1d46fc02705c51b81638d67.tar.gz
cpython-2f01c562be913004e1d46fc02705c51b81638d67.tar.bz2
[3.7] bpo-43660: Fix crash when displaying exceptions with custom values for sys.stderr (GH-25075). (GH-25085)
(cherry picked from commit 09b90a037d18f5d4acdf1b14082e57bda78e85d3) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
Diffstat (limited to 'Python/pythonrun.c')
-rw-r--r--Python/pythonrun.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index 4c974ce..b7b77d1 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -932,7 +932,9 @@ PyErr_Display(PyObject *exception, PyObject *value, PyObject *tb)
seen = PySet_New(NULL);
if (seen == NULL)
PyErr_Clear();
+ Py_INCREF(f);
print_exception_recursive(f, value, seen);
+ Py_DECREF(f);
Py_XDECREF(seen);
}
}