summaryrefslogtreecommitdiffstats
path: root/Python/bytecodes.c
diff options
context:
space:
mode:
authorBénédikt Tran <10796600+picnixz@users.noreply.github.com>2025-04-18 10:24:34 (GMT)
committerGitHub <noreply@github.com>2025-04-18 10:24:34 (GMT)
commit379352620ce4d77f7248939a4cf211db48fdd241 (patch)
tree49dd21e4e3d0b20aabce878df71e2d4ce04d23fd /Python/bytecodes.c
parentf3d877a27abca355f9d05decf3e2ce0874983288 (diff)
downloadcpython-379352620ce4d77f7248939a4cf211db48fdd241.zip
cpython-379352620ce4d77f7248939a4cf211db48fdd241.tar.gz
cpython-379352620ce4d77f7248939a4cf211db48fdd241.tar.bz2
gh-132097: use a macro for semantically casting function pointers (#132406)
Diffstat (limited to 'Python/bytecodes.c')
-rw-r--r--Python/bytecodes.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/Python/bytecodes.c b/Python/bytecodes.c
index 95786c9..8aa41c2 100644
--- a/Python/bytecodes.c
+++ b/Python/bytecodes.c
@@ -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));