summaryrefslogtreecommitdiff
path: root/Python/pythonrun.c
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2008-08-26 22:02:58 +0000
committerAntoine Pitrou <solipsis@pitrou.net>2008-08-26 22:02:58 +0000
commitab2f6d17f47d7573e4ca4ea3da43893e3f8ff5f2 (patch)
tree9e0482e5c75dab89fb446b28ab553c1feec019d7 /Python/pythonrun.c
parente9280f26630fc9eb2a0afa15a50d6fb38ab2e78d (diff)
downloadcpython-ab2f6d17f47d7573e4ca4ea3da43893e3f8ff5f2.tar.gz
#3663: extra DECREF on syntax errors.
Patch by Amaury Forgeot d'Arc, reviewed by Benjamin Peterson.
Diffstat (limited to 'Python/pythonrun.c')
-rw-r--r--Python/pythonrun.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index 1ee062fe6f..39c86e749f 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -1242,7 +1242,10 @@ PyErr_PrintEx(int set_sys_last_vars)
if (exception == NULL)
return;
PyErr_NormalizeException(&exception, &v, &tb);
- tb = tb ? tb : Py_None;
+ if (tb == NULL) {
+ tb = Py_None;
+ Py_INCREF(tb);
+ }
PyException_SetTraceback(v, tb);
if (exception == NULL)
return;