File indexing completed on 2025-11-19 09:50:53
0001
0002
0003
0004 #ifndef Py_METHODOBJECT_H
0005 #define Py_METHODOBJECT_H
0006 #ifdef __cplusplus
0007 extern "C" {
0008 #endif
0009
0010
0011
0012
0013
0014 PyAPI_DATA(PyTypeObject) PyCFunction_Type;
0015
0016 #define PyCFunction_CheckExact(op) Py_IS_TYPE((op), &PyCFunction_Type)
0017 #define PyCFunction_Check(op) PyObject_TypeCheck((op), &PyCFunction_Type)
0018
0019 typedef PyObject *(*PyCFunction)(PyObject *, PyObject *);
0020 typedef PyObject *(*PyCFunctionFast) (PyObject *, PyObject *const *, Py_ssize_t);
0021 typedef PyObject *(*PyCFunctionWithKeywords)(PyObject *, PyObject *,
0022 PyObject *);
0023 typedef PyObject *(*PyCFunctionFastWithKeywords) (PyObject *,
0024 PyObject *const *, Py_ssize_t,
0025 PyObject *);
0026 typedef PyObject *(*PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *,
0027 size_t, PyObject *);
0028
0029
0030
0031
0032
0033 typedef PyCFunctionFast _PyCFunctionFast;
0034 typedef PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords;
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052 #define _PyCFunction_CAST(func) \
0053 _Py_CAST(PyCFunction, _Py_CAST(void(*)(void), (func)))
0054
0055 PyAPI_FUNC(PyCFunction) PyCFunction_GetFunction(PyObject *);
0056 PyAPI_FUNC(PyObject *) PyCFunction_GetSelf(PyObject *);
0057 PyAPI_FUNC(int) PyCFunction_GetFlags(PyObject *);
0058
0059 struct PyMethodDef {
0060 const char *ml_name;
0061 PyCFunction ml_meth;
0062 int ml_flags;
0063
0064 const char *ml_doc;
0065 };
0066
0067
0068
0069
0070 PyAPI_FUNC(PyObject *) PyCFunction_New(PyMethodDef *, PyObject *);
0071 #define PyCFunction_New(ML, SELF) PyCFunction_NewEx((ML), (SELF), NULL)
0072
0073
0074 PyAPI_FUNC(PyObject *) PyCFunction_NewEx(PyMethodDef *, PyObject *,
0075 PyObject *);
0076
0077 #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03090000
0078 #define PyCFunction_NewEx(ML, SELF, MOD) PyCMethod_New((ML), (SELF), (MOD), NULL)
0079 PyAPI_FUNC(PyObject *) PyCMethod_New(PyMethodDef *, PyObject *,
0080 PyObject *, PyTypeObject *);
0081 #endif
0082
0083
0084
0085
0086 #define METH_VARARGS 0x0001
0087 #define METH_KEYWORDS 0x0002
0088
0089 #define METH_NOARGS 0x0004
0090 #define METH_O 0x0008
0091
0092
0093
0094
0095 #define METH_CLASS 0x0010
0096 #define METH_STATIC 0x0020
0097
0098
0099
0100
0101
0102
0103 #define METH_COEXIST 0x0040
0104
0105 #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030a0000
0106 # define METH_FASTCALL 0x0080
0107 #endif
0108
0109
0110 #ifdef STACKLESS
0111 # define METH_STACKLESS 0x0100
0112 #else
0113 # define METH_STACKLESS 0x0000
0114 #endif
0115
0116
0117
0118
0119
0120
0121
0122
0123 #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03090000
0124 #define METH_METHOD 0x0200
0125 #endif
0126
0127
0128 #ifndef Py_LIMITED_API
0129 # define Py_CPYTHON_METHODOBJECT_H
0130 # include "cpython/methodobject.h"
0131 # undef Py_CPYTHON_METHODOBJECT_H
0132 #endif
0133
0134 #ifdef __cplusplus
0135 }
0136 #endif
0137 #endif