Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 024da35

Browse files
committed
PyErr_Occurred(): Use PyThreadState_GET(), which saves a tiny function call
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
1 parent 6cba3d0 commit 024da35

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Python/errors.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ PyErr_SetString(PyObject *exception, const char *string)
7575
PyObject *
7676
PyErr_Occurred(void)
7777
{
78-
PyThreadState *tstate = PyThreadState_Get();
78+
PyThreadState *tstate = PyThreadState_GET();
7979

8080
return tstate->curexc_type;
8181
}

0 commit comments

Comments
 (0)