summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2013-11-23 13:05:23 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2013-11-23 13:05:23 (GMT)
commit8933521b3dec9a6ac55b91f2ff604528381a157c (patch)
treee9acf9d1f018714643381abc419aa690939e8720 /Python/ceval.c
parent72d28500b3c5e6f4051826432b2a801ce4e556f4 (diff)
downloadcpython-8933521b3dec9a6ac55b91f2ff604528381a157c.zip
cpython-8933521b3dec9a6ac55b91f2ff604528381a157c.tar.gz
cpython-8933521b3dec9a6ac55b91f2ff604528381a157c.tar.bz2
Fix refleak introduced by 4f730c045f5f (issue #18408) and unveiled by 95eea8624d05 (issue #16596).
Diffstat (limited to 'Python/ceval.c')
-rw-r--r--Python/ceval.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index ab419dc..82f0651 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -3850,20 +3850,16 @@ call_exc_trace(Py_tracefunc func, PyObject *self, PyFrameObject *f)
{
PyObject *type, *value, *traceback, *orig_traceback, *arg;
int err;
- PyErr_Fetch(&type, &value, &traceback);
+ PyErr_Fetch(&type, &value, &orig_traceback);
if (value == NULL) {
value = Py_None;
Py_INCREF(value);
}
- PyErr_NormalizeException(&type, &value, &traceback);
- orig_traceback = traceback;
- if (traceback == NULL) {
- Py_INCREF(Py_None);
- traceback = Py_None;
- }
+ PyErr_NormalizeException(&type, &value, &orig_traceback);
+ traceback = (orig_traceback != NULL) ? orig_traceback : Py_None;
arg = PyTuple_Pack(3, type, value, traceback);
if (arg == NULL) {
- PyErr_Restore(type, value, traceback);
+ PyErr_Restore(type, value, orig_traceback);
return;
}
err = call_trace(func, self, f, PyTrace_EXCEPTION, arg);