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/methodobject.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/methodobject.c')
-rw-r--r-- | Objects/methodobject.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Objects/methodobject.c b/Objects/methodobject.c index 8bcb1e0..953cf46 100644 --- a/Objects/methodobject.c +++ b/Objects/methodobject.c @@ -2,7 +2,7 @@ /* Method object implementation */ #include "Python.h" -#include "pycore_ceval.h" // _Py_EnterRecursiveCall() +#include "pycore_ceval.h" // _Py_EnterRecursiveCallTstate() #include "pycore_object.h" #include "pycore_pyerrors.h" #include "pycore_pystate.h" // _PyThreadState_GET() @@ -403,7 +403,7 @@ typedef void (*funcptr)(void); static inline funcptr cfunction_enter_call(PyThreadState *tstate, PyObject *func) { - if (_Py_EnterRecursiveCall(tstate, " while calling a Python object")) { + if (_Py_EnterRecursiveCallTstate(tstate, " while calling a Python object")) { return NULL; } return (funcptr)PyCFunction_GET_FUNCTION(func); @@ -425,7 +425,7 @@ cfunction_vectorcall_FASTCALL( return NULL; } PyObject *result = meth(PyCFunction_GET_SELF(func), args, nargs); - _Py_LeaveRecursiveCall(tstate); + _Py_LeaveRecursiveCallTstate(tstate); return result; } @@ -441,7 +441,7 @@ cfunction_vectorcall_FASTCALL_KEYWORDS( return NULL; } PyObject *result = meth(PyCFunction_GET_SELF(func), args, nargs, kwnames); - _Py_LeaveRecursiveCall(tstate); + _Py_LeaveRecursiveCallTstate(tstate); return result; } @@ -457,7 +457,7 @@ cfunction_vectorcall_FASTCALL_KEYWORDS_METHOD( return NULL; } PyObject *result = meth(PyCFunction_GET_SELF(func), cls, args, nargs, kwnames); - _Py_LeaveRecursiveCall(tstate); + _Py_LeaveRecursiveCallTstate(tstate); return result; } @@ -485,7 +485,7 @@ cfunction_vectorcall_NOARGS( } PyObject *result = _PyCFunction_TrampolineCall( meth, PyCFunction_GET_SELF(func), NULL); - _Py_LeaveRecursiveCall(tstate); + _Py_LeaveRecursiveCallTstate(tstate); return result; } @@ -513,7 +513,7 @@ cfunction_vectorcall_O( } PyObject *result = _PyCFunction_TrampolineCall( meth, PyCFunction_GET_SELF(func), args[0]); - _Py_LeaveRecursiveCall(tstate); + _Py_LeaveRecursiveCallTstate(tstate); return result; } |