|
|
|
|
|
|
|
#ifndef Py_METHODOBJECT_H |
|
#define Py_METHODOBJECT_H |
|
#ifdef __cplusplus |
|
extern "C" { |
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
PyAPI_DATA(PyTypeObject) PyCFunction_Type; |
|
|
|
#define PyCFunction_CheckExact(op) Py_IS_TYPE(op, &PyCFunction_Type) |
|
#define PyCFunction_Check(op) PyObject_TypeCheck(op, &PyCFunction_Type) |
|
|
|
typedef PyObject *(*PyCFunction)(PyObject *, PyObject *); |
|
typedef PyObject *(*_PyCFunctionFast) (PyObject *, PyObject *const *, Py_ssize_t); |
|
typedef PyObject *(*PyCFunctionWithKeywords)(PyObject *, PyObject *, |
|
PyObject *); |
|
typedef PyObject *(*_PyCFunctionFastWithKeywords) (PyObject *, |
|
PyObject *const *, Py_ssize_t, |
|
PyObject *); |
|
typedef PyObject *(*PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *, |
|
size_t, PyObject *); |
|
|
|
PyAPI_FUNC(PyCFunction) PyCFunction_GetFunction(PyObject *); |
|
PyAPI_FUNC(PyObject *) PyCFunction_GetSelf(PyObject *); |
|
PyAPI_FUNC(int) PyCFunction_GetFlags(PyObject *); |
|
|
|
Py_DEPRECATED(3.9) PyAPI_FUNC(PyObject *) PyCFunction_Call(PyObject *, PyObject *, PyObject *); |
|
|
|
struct PyMethodDef { |
|
const char *ml_name; |
|
PyCFunction ml_meth; |
|
int ml_flags; |
|
|
|
const char *ml_doc; |
|
}; |
|
typedef struct PyMethodDef PyMethodDef; |
|
|
|
|
|
|
|
|
|
PyAPI_FUNC(PyObject *) PyCFunction_New(PyMethodDef *, PyObject *); |
|
#define PyCFunction_New(ML, SELF) PyCFunction_NewEx((ML), (SELF), NULL) |
|
|
|
|
|
PyAPI_FUNC(PyObject *) PyCFunction_NewEx(PyMethodDef *, PyObject *, |
|
PyObject *); |
|
|
|
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03090000 |
|
#define PyCFunction_NewEx(ML, SELF, MOD) PyCMethod_New((ML), (SELF), (MOD), NULL) |
|
PyAPI_FUNC(PyObject *) PyCMethod_New(PyMethodDef *, PyObject *, |
|
PyObject *, PyTypeObject *); |
|
#endif |
|
|
|
|
|
|
|
|
|
#define METH_VARARGS 0x0001 |
|
#define METH_KEYWORDS 0x0002 |
|
|
|
#define METH_NOARGS 0x0004 |
|
#define METH_O 0x0008 |
|
|
|
|
|
|
|
|
|
#define METH_CLASS 0x0010 |
|
#define METH_STATIC 0x0020 |
|
|
|
|
|
|
|
|
|
|
|
|
|
#define METH_COEXIST 0x0040 |
|
|
|
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030a0000 |
|
# define METH_FASTCALL 0x0080 |
|
#endif |
|
|
|
|
|
#ifdef STACKLESS |
|
# define METH_STACKLESS 0x0100 |
|
#else |
|
# define METH_STACKLESS 0x0000 |
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03090000 |
|
#define METH_METHOD 0x0200 |
|
#endif |
|
|
|
|
|
#ifndef Py_LIMITED_API |
|
|
|
#define Py_CPYTHON_METHODOBJECT_H |
|
#include "cpython/methodobject.h" |
|
#undef Py_CPYTHON_METHODOBJECT_H |
|
|
|
#endif |
|
|
|
#ifdef __cplusplus |
|
} |
|
#endif |
|
#endif |
|
|