File indexing completed on 2025-01-18 10:06:49
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
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045 #define _PyCFunction_CAST(func) \
0046 _Py_CAST(PyCFunction, _Py_CAST(void(*)(void), (func)))
0047
0048 PyAPI_FUNC(PyCFunction) PyCFunction_GetFunction(PyObject *);
0049 PyAPI_FUNC(PyObject *) PyCFunction_GetSelf(PyObject *);
0050 PyAPI_FUNC(int) PyCFunction_GetFlags(PyObject *);
0051
0052 Py_DEPRECATED(3.9) PyAPI_FUNC(PyObject *) PyCFunction_Call(PyObject *, PyObject *, PyObject *);
0053
0054 struct PyMethodDef {
0055 const char *ml_name;
0056 PyCFunction ml_meth;
0057 int ml_flags;
0058
0059 const char *ml_doc;
0060 };
0061
0062
0063
0064
0065 PyAPI_FUNC(PyObject *) PyCFunction_New(PyMethodDef *, PyObject *);
0066 #define PyCFunction_New(ML, SELF) PyCFunction_NewEx((ML), (SELF), NULL)
0067
0068
0069 PyAPI_FUNC(PyObject *) PyCFunction_NewEx(PyMethodDef *, PyObject *,
0070 PyObject *);
0071
0072 #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03090000
0073 #define PyCFunction_NewEx(ML, SELF, MOD) PyCMethod_New((ML), (SELF), (MOD), NULL)
0074 PyAPI_FUNC(PyObject *) PyCMethod_New(PyMethodDef *, PyObject *,
0075 PyObject *, PyTypeObject *);
0076 #endif
0077
0078
0079
0080
0081 #define METH_VARARGS 0x0001
0082 #define METH_KEYWORDS 0x0002
0083
0084 #define METH_NOARGS 0x0004
0085 #define METH_O 0x0008
0086
0087
0088
0089
0090 #define METH_CLASS 0x0010
0091 #define METH_STATIC 0x0020
0092
0093
0094
0095
0096
0097
0098 #define METH_COEXIST 0x0040
0099
0100 #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030a0000
0101 # define METH_FASTCALL 0x0080
0102 #endif
0103
0104
0105 #ifdef STACKLESS
0106 # define METH_STACKLESS 0x0100
0107 #else
0108 # define METH_STACKLESS 0x0000
0109 #endif
0110
0111
0112
0113
0114
0115
0116
0117
0118 #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03090000
0119 #define METH_METHOD 0x0200
0120 #endif
0121
0122
0123 #ifndef Py_LIMITED_API
0124 # define Py_CPYTHON_METHODOBJECT_H
0125 # include "cpython/methodobject.h"
0126 # undef Py_CPYTHON_METHODOBJECT_H
0127 #endif
0128
0129 #ifdef __cplusplus
0130 }
0131 #endif
0132 #endif