diff options
author | Victor Stinner <vstinner@python.org> | 2022-05-04 11:30:23 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-04 11:30:23 (GMT) |
commit | d716a0dfe2d1029111db393afaecdb04cc4093de (patch) | |
tree | 2644817d65b365bf1dd2872661948d1b564bff32 /Objects/call.c | |
parent | 14243369b5f80613628a565c224bba7fb3fcacd8 (diff) | |
download | cpython-d716a0dfe2d1029111db393afaecdb04cc4093de.zip cpython-d716a0dfe2d1029111db393afaecdb04cc4093de.tar.gz cpython-d716a0dfe2d1029111db393afaecdb04cc4093de.tar.bz2 |
Use static inline function Py_EnterRecursiveCall() (#91988)
Currently, calling Py_EnterRecursiveCall() and
Py_LeaveRecursiveCall() may use a function call or a static inline
function call, depending if the internal pycore_ceval.h header file
is included or not. Use a different name for the static inline
function to ensure that the static inline function is always used in
Python internals for best performance. Similar approach than
PyThreadState_GET() (function call) and _PyThreadState_GET() (static
inline function).
* Rename _Py_EnterRecursiveCall() to _Py_EnterRecursiveCallTstate()
* Rename _Py_LeaveRecursiveCall() to _Py_LeaveRecursiveCallTstate()
* pycore_ceval.h: Rename Py_EnterRecursiveCall() to
_Py_EnterRecursiveCall() and Py_LeaveRecursiveCall() and
_Py_LeaveRecursiveCall()
Diffstat (limited to 'Objects/call.c')
-rw-r--r-- | Objects/call.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Objects/call.c b/Objects/call.c index 4484762..678d162 100644 --- a/Objects/call.c +++ b/Objects/call.c @@ -209,11 +209,11 @@ _PyObject_MakeTpCall(PyThreadState *tstate, PyObject *callable, } PyObject *result = NULL; - if (_Py_EnterRecursiveCall(tstate, " while calling a Python object") == 0) + if (_Py_EnterRecursiveCallTstate(tstate, " while calling a Python object") == 0) { result = _PyCFunctionWithKeywords_TrampolineCall( (PyCFunctionWithKeywords)call, callable, argstuple, kwdict); - _Py_LeaveRecursiveCall(tstate); + _Py_LeaveRecursiveCallTstate(tstate); } Py_DECREF(argstuple); @@ -336,13 +336,13 @@ _PyObject_Call(PyThreadState *tstate, PyObject *callable, return NULL; } - if (_Py_EnterRecursiveCall(tstate, " while calling a Python object")) { + if (_Py_EnterRecursiveCallTstate(tstate, " while calling a Python object")) { return NULL; } result = (*call)(callable, args, kwargs); - _Py_LeaveRecursiveCall(tstate); + _Py_LeaveRecursiveCallTstate(tstate); return _Py_CheckFunctionResult(tstate, callable, result, NULL); } |