xref: /aosp_15_r20/external/pytorch/torch/csrc/utils/pycfunction_helpers.h (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1 #pragma once
2 
3 #include <c10/macros/Macros.h>
4 
5 #include <Python.h>
6 
castPyCFunctionWithKeywords(PyCFunctionWithKeywords func)7 inline PyCFunction castPyCFunctionWithKeywords(PyCFunctionWithKeywords func) {
8   C10_DIAGNOSTIC_PUSH_AND_IGNORED_IF_DEFINED("-Wcast-function-type")
9   C10_DIAGNOSTIC_PUSH_AND_IGNORED_IF_DEFINED("-Wcast-function-type-strict")
10   return reinterpret_cast<PyCFunction>(func);
11   C10_DIAGNOSTIC_POP()
12   C10_DIAGNOSTIC_POP()
13 }
14