antoine.pitrou
2008-08-26 22:02:58 UTC
Author: antoine.pitrou
Date: Wed Aug 27 00:02:58 2008
New Revision: 66041
Log:
#3663: extra DECREF on syntax errors.
Patch by Amaury Forgeot d'Arc, reviewed by Benjamin Peterson.
Modified:
python/branches/py3k/Misc/NEWS
python/branches/py3k/Python/pythonrun.c
Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS (original)
+++ python/branches/py3k/Misc/NEWS Wed Aug 27 00:02:58 2008
@@ -12,6 +12,8 @@
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.
Modified: python/branches/py3k/Python/pythonrun.c
==============================================================================
--- python/branches/py3k/Python/pythonrun.c (original)
+++ python/branches/py3k/Python/pythonrun.c Wed Aug 27 00:02:58 2008
@@ -1242,7 +1242,10 @@
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;
Date: Wed Aug 27 00:02:58 2008
New Revision: 66041
Log:
#3663: extra DECREF on syntax errors.
Patch by Amaury Forgeot d'Arc, reviewed by Benjamin Peterson.
Modified:
python/branches/py3k/Misc/NEWS
python/branches/py3k/Python/pythonrun.c
Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS (original)
+++ python/branches/py3k/Misc/NEWS Wed Aug 27 00:02:58 2008
@@ -12,6 +12,8 @@
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.
Modified: python/branches/py3k/Python/pythonrun.c
==============================================================================
--- python/branches/py3k/Python/pythonrun.c (original)
+++ python/branches/py3k/Python/pythonrun.c Wed Aug 27 00:02:58 2008
@@ -1242,7 +1242,10 @@
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;