]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
PyErr_Occurred(): Use PyThreadState_GET(), which saves a tiny function call
authorTim Peters <tim.peters@gmail.com>
Wed, 30 May 2001 06:09:50 +0000 (06:09 +0000)
committerTim Peters <tim.peters@gmail.com>
Wed, 30 May 2001 06:09:50 +0000 (06:09 +0000)
in release builds.  Suggested by Martin v. Loewis.

I'm half tempted to macroize PyErr_Occurred too, as the whole thing could
collapse to just
     _PyThreadState_Current->curexc_type

Python/errors.c

index 8d02b8e262211e1cea562cac16cf578a9c9e1b46..89d956f9777006ec3952ed7cf969a587ca4349b1 100644 (file)
@@ -75,7 +75,7 @@ PyErr_SetString(PyObject *exception, const char *string)
 PyObject *
 PyErr_Occurred(void)
 {
-       PyThreadState *tstate = PyThreadState_Get();
+       PyThreadState *tstate = PyThreadState_GET();
 
        return tstate->curexc_type;
 }