mirror of
https://github.com/python/cpython.git
synced 2026-04-04 19:13:16 +00:00
gh-132097: use a macro for semantically casting function pointers (#132406)
This commit is contained in:
parent
f3d877a27a
commit
379352620c
9 changed files with 47 additions and 31 deletions
|
|
@ -4170,7 +4170,7 @@ dummy_func(
|
|||
DECREF_INPUTS();
|
||||
ERROR_IF(true, error);
|
||||
}
|
||||
PyObject *res_o = ((PyCFunctionFast)(void(*)(void))cfunc)(
|
||||
PyObject *res_o = _PyCFunctionFast_CAST(cfunc)(
|
||||
PyCFunction_GET_SELF(callable_o),
|
||||
args_o,
|
||||
total_args);
|
||||
|
|
@ -4202,8 +4202,7 @@ dummy_func(
|
|||
STAT_INC(CALL, hit);
|
||||
/* res = func(self, arguments, nargs, kwnames) */
|
||||
PyCFunctionFastWithKeywords cfunc =
|
||||
(PyCFunctionFastWithKeywords)(void(*)(void))
|
||||
PyCFunction_GET_FUNCTION(callable_o);
|
||||
_PyCFunctionFastWithKeywords_CAST(PyCFunction_GET_FUNCTION(callable_o));
|
||||
|
||||
STACKREFS_TO_PYOBJECTS(arguments, total_args, args_o);
|
||||
if (CONVERSION_FAILED(args_o)) {
|
||||
|
|
@ -4371,7 +4370,7 @@ dummy_func(
|
|||
ERROR_IF(true, error);
|
||||
}
|
||||
PyCFunctionFastWithKeywords cfunc =
|
||||
(PyCFunctionFastWithKeywords)(void(*)(void))meth->ml_meth;
|
||||
_PyCFunctionFastWithKeywords_CAST(meth->ml_meth);
|
||||
PyObject *res_o = cfunc(self, (args_o + 1), nargs, NULL);
|
||||
STACKREFS_TO_PYOBJECTS_CLEANUP(args_o);
|
||||
assert((res_o != NULL) ^ (_PyErr_Occurred(tstate) != NULL));
|
||||
|
|
@ -4450,8 +4449,7 @@ dummy_func(
|
|||
DECREF_INPUTS();
|
||||
ERROR_IF(true, error);
|
||||
}
|
||||
PyCFunctionFast cfunc =
|
||||
(PyCFunctionFast)(void(*)(void))meth->ml_meth;
|
||||
PyCFunctionFast cfunc = _PyCFunctionFast_CAST(meth->ml_meth);
|
||||
PyObject *res_o = cfunc(self, (args_o + 1), nargs);
|
||||
STACKREFS_TO_PYOBJECTS_CLEANUP(args_o);
|
||||
assert((res_o != NULL) ^ (_PyErr_Occurred(tstate) != NULL));
|
||||
|
|
|
|||
10
Python/executor_cases.c.h
generated
10
Python/executor_cases.c.h
generated
|
|
@ -5507,7 +5507,7 @@
|
|||
JUMP_TO_ERROR();
|
||||
}
|
||||
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||
PyObject *res_o = ((PyCFunctionFast)(void(*)(void))cfunc)(
|
||||
PyObject *res_o = _PyCFunctionFast_CAST(cfunc)(
|
||||
PyCFunction_GET_SELF(callable_o),
|
||||
args_o,
|
||||
total_args);
|
||||
|
|
@ -5567,8 +5567,7 @@
|
|||
STAT_INC(CALL, hit);
|
||||
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||
PyCFunctionFastWithKeywords cfunc =
|
||||
(PyCFunctionFastWithKeywords)(void(*)(void))
|
||||
PyCFunction_GET_FUNCTION(callable_o);
|
||||
_PyCFunctionFastWithKeywords_CAST(PyCFunction_GET_FUNCTION(callable_o));
|
||||
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||
STACKREFS_TO_PYOBJECTS(arguments, total_args, args_o);
|
||||
if (CONVERSION_FAILED(args_o)) {
|
||||
|
|
@ -5918,7 +5917,7 @@
|
|||
}
|
||||
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||
PyCFunctionFastWithKeywords cfunc =
|
||||
(PyCFunctionFastWithKeywords)(void(*)(void))meth->ml_meth;
|
||||
_PyCFunctionFastWithKeywords_CAST(meth->ml_meth);
|
||||
PyObject *res_o = cfunc(self, (args_o + 1), nargs, NULL);
|
||||
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||
STACKREFS_TO_PYOBJECTS_CLEANUP(args_o);
|
||||
|
|
@ -6073,8 +6072,7 @@
|
|||
JUMP_TO_ERROR();
|
||||
}
|
||||
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||
PyCFunctionFast cfunc =
|
||||
(PyCFunctionFast)(void(*)(void))meth->ml_meth;
|
||||
PyCFunctionFast cfunc = _PyCFunctionFast_CAST(meth->ml_meth);
|
||||
PyObject *res_o = cfunc(self, (args_o + 1), nargs);
|
||||
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||
STACKREFS_TO_PYOBJECTS_CLEANUP(args_o);
|
||||
|
|
|
|||
10
Python/generated_cases.c.h
generated
10
Python/generated_cases.c.h
generated
|
|
@ -2060,7 +2060,7 @@
|
|||
JUMP_TO_LABEL(error);
|
||||
}
|
||||
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||
PyObject *res_o = ((PyCFunctionFast)(void(*)(void))cfunc)(
|
||||
PyObject *res_o = _PyCFunctionFast_CAST(cfunc)(
|
||||
PyCFunction_GET_SELF(callable_o),
|
||||
args_o,
|
||||
total_args);
|
||||
|
|
@ -2153,8 +2153,7 @@
|
|||
STAT_INC(CALL, hit);
|
||||
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||
PyCFunctionFastWithKeywords cfunc =
|
||||
(PyCFunctionFastWithKeywords)(void(*)(void))
|
||||
PyCFunction_GET_FUNCTION(callable_o);
|
||||
_PyCFunctionFastWithKeywords_CAST(PyCFunction_GET_FUNCTION(callable_o));
|
||||
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||
STACKREFS_TO_PYOBJECTS(arguments, total_args, args_o);
|
||||
if (CONVERSION_FAILED(args_o)) {
|
||||
|
|
@ -3377,8 +3376,7 @@
|
|||
JUMP_TO_LABEL(error);
|
||||
}
|
||||
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||
PyCFunctionFast cfunc =
|
||||
(PyCFunctionFast)(void(*)(void))meth->ml_meth;
|
||||
PyCFunctionFast cfunc = _PyCFunctionFast_CAST(meth->ml_meth);
|
||||
PyObject *res_o = cfunc(self, (args_o + 1), nargs);
|
||||
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||
STACKREFS_TO_PYOBJECTS_CLEANUP(args_o);
|
||||
|
|
@ -3505,7 +3503,7 @@
|
|||
}
|
||||
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||
PyCFunctionFastWithKeywords cfunc =
|
||||
(PyCFunctionFastWithKeywords)(void(*)(void))meth->ml_meth;
|
||||
_PyCFunctionFastWithKeywords_CAST(meth->ml_meth);
|
||||
PyObject *res_o = cfunc(self, (args_o + 1), nargs, NULL);
|
||||
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||
STACKREFS_TO_PYOBJECTS_CLEANUP(args_o);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue