summaryrefslogtreecommitdiff
path: root/Python/pythonrun.c
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2021-03-29 16:24:33 -0700
committerGitHub <noreply@github.com>2021-03-30 00:24:33 +0100
commitff4715a7332123713de9920e724bb6c412d8ccef (patch)
treeb6dad8054715457ca8074d28868754f278c77d1e /Python/pythonrun.c
parentacb584958e215aff8fc8f5e2eb3fef481b662f69 (diff)
downloadcpython-git-ff4715a7332123713de9920e724bb6c412d8ccef.tar.gz
bpo-43660: Fix crash when displaying exceptions with custom values for sys.stderr (GH-25075) (GH-25083)
(cherry picked from commit 09b90a037d18f5d4acdf1b14082e57bda78e85d3) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com> Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
Diffstat (limited to 'Python/pythonrun.c')
-rw-r--r--Python/pythonrun.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index 04540989f3..34cfb7f4b4 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -1072,8 +1072,9 @@ PyErr_Display(PyObject *exception, PyObject *value, PyObject *tb)
if (file == Py_None) {
return;
}
-
+ Py_INCREF(file);
_PyErr_Display(file, exception, value, tb);
+ Py_DECREF(file);
}
PyObject *