summaryrefslogtreecommitdiffstats
path: root/Python/pythonrun.c
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2008-08-26 22:02:58 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2008-08-26 22:02:58 (GMT)
commite2dffc0aeb6e03d8e6512a13cb3fe05562f7c655 (patch)
treeb01c31ee5f3b2625cbf01c52b2bea67061c02226 /Python/pythonrun.c
parent2b9e040091cbb5e0c1ecd0479cca74d07a0e10d7 (diff)
downloadcpython-e2dffc0aeb6e03d8e6512a13cb3fe05562f7c655.zip
cpython-e2dffc0aeb6e03d8e6512a13cb3fe05562f7c655.tar.gz
cpython-e2dffc0aeb6e03d8e6512a13cb3fe05562f7c655.tar.bz2
#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 1ee062f..39c86e7 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;