]> granicus.if.org Git - python/commitdiff
#3663: extra DECREF on syntax errors.
authorAntoine Pitrou <solipsis@pitrou.net>
Tue, 26 Aug 2008 22:02:58 +0000 (22:02 +0000)
committerAntoine Pitrou <solipsis@pitrou.net>
Tue, 26 Aug 2008 22:02:58 +0000 (22:02 +0000)
Patch by Amaury Forgeot d'Arc, reviewed by Benjamin Peterson.

Misc/NEWS
Python/pythonrun.c

index d77913242238977ad0fde32b8806f4d3e35e30a8..2d91cb1e01f1863e61c93edfefcf067df718a9d3 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,8 @@ What's New in Python 3.0 release candidate 1
 Core and Builtins
 -----------------
 
+- Issue #3663: Py_None was decref'd when printing SyntaxErrors.
+
 - Issue #3657: Fix uninitialized memory read when pickling longs.
   Found by valgrind.
 
index 1ee062fe6fa7b5675f778eed66a8104e9917ee57..39c86e749f721cca344adafc6a13a890e68e23f7 100644 (file)
@@ -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;