From 4a3020c87a798c3c8d0e7e889ed714cdf3e87d5f Mon Sep 17 00:00:00 2001 From: Pasha Stetsenko Date: Tue, 28 Nov 2023 09:50:08 -0800 Subject: [PATCH] fix a compiler warning --- src/core/python/ext_module.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/core/python/ext_module.h b/src/core/python/ext_module.h index 2a4e5d69cd..ea71efe21a 100644 --- a/src/core/python/ext_module.h +++ b/src/core/python/ext_module.h @@ -62,12 +62,17 @@ class ExtModule { } void add(PyCFunctionWithKeywords F, PKArgs& args) { + // According to Python docs, the second parameter can be a function of different + // types, whose interpretation will depend on the [ml_flags]. + // (https://docs.python.org/3/c-api/structures.html#c.PyMethodDef) + DISABLE_CLANG_WARNING("-Wcast-function-type") methods.push_back(PyMethodDef { args.get_short_name(), reinterpret_cast(F), METH_VARARGS | METH_KEYWORDS, args.get_docstring() }); + RESTORE_CLANG_WARNING("-Wcast-function-type") } private: