From: Guido van Rossum Date: Mon, 23 Sep 2002 21:19:44 +0000 (+0000) Subject: Backported 1.39 and 1.40 from trunk: X-Git-Tag: v2.2.2b1~146 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2992e13268d5ae307755ff00778221396d09db27;p=thirdparty%2FPython%2Fcpython.git Backported 1.39 and 1.40 from trunk: 1.39: Fix SF bug 610610 (reported by Martijn Pieters, diagnosed by Neal Norwitz). The switch in Exception__str__ didn't clear the error if PySequence_Size() raised an exception. Added a case -1 which clears the error and falls through to the default case. 1.40: Two more cases of switch(PySequence_Size()) without checking for case -1. (Same problem as last checkin for SF bug 610610) Need to clear the error and proceed. --- diff --git a/Python/exceptions.c b/Python/exceptions.c index adfd699320ec..7f4c3d0e8179 100644 --- a/Python/exceptions.c +++ b/Python/exceptions.c @@ -278,6 +278,9 @@ Exception__str__(PyObject *self, PyObject *args) out = NULL; break; } + case -1: + PyErr_Clear(); + /* Fall through */ default: out = PyObject_Str(args); break; @@ -409,6 +412,9 @@ SystemExit__init__(PyObject *self, PyObject *args) case 1: code = PySequence_GetItem(args, 0); break; + case -1: + PyErr_Clear(); + /* Fall through */ default: Py_INCREF(args); code = args; @@ -515,6 +521,10 @@ EnvironmentError__init__(PyObject *self, PyObject *args) goto finally; } break; + + case -1: + PyErr_Clear(); + break; } Py_INCREF(Py_None);