2021-08-08 04:08:33 +00:00
|
|
|
#ifndef Py_LIMITED_API
|
|
|
|
#ifndef Py_CLASSOBJECT_H
|
|
|
|
#define Py_CLASSOBJECT_H
|
2021-08-12 07:42:14 +00:00
|
|
|
#include "third_party/python/Include/object.h"
|
2021-08-10 17:26:13 +00:00
|
|
|
COSMOPOLITAN_C_START_
|
2021-08-08 04:08:33 +00:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
PyObject_HEAD
|
|
|
|
PyObject *im_func; /* The callable object implementing the method */
|
|
|
|
PyObject *im_self; /* The instance it is bound to */
|
|
|
|
PyObject *im_weakreflist; /* List of weak references */
|
|
|
|
} PyMethodObject;
|
|
|
|
|
2021-08-12 07:42:14 +00:00
|
|
|
extern PyTypeObject PyMethod_Type;
|
2021-08-08 04:08:33 +00:00
|
|
|
|
|
|
|
#define PyMethod_Check(op) ((op)->ob_type == &PyMethod_Type)
|
|
|
|
|
2021-08-12 07:42:14 +00:00
|
|
|
PyObject * PyMethod_New(PyObject *, PyObject *);
|
2021-08-08 04:08:33 +00:00
|
|
|
|
2021-08-12 07:42:14 +00:00
|
|
|
PyObject * PyMethod_Function(PyObject *);
|
|
|
|
PyObject * PyMethod_Self(PyObject *);
|
2021-08-08 04:08:33 +00:00
|
|
|
|
|
|
|
/* Macros for direct access to these values. Type checks are *not*
|
|
|
|
done, so use with care. */
|
|
|
|
#define PyMethod_GET_FUNCTION(meth) \
|
|
|
|
(((PyMethodObject *)meth) -> im_func)
|
|
|
|
#define PyMethod_GET_SELF(meth) \
|
|
|
|
(((PyMethodObject *)meth) -> im_self)
|
|
|
|
|
2021-08-12 07:42:14 +00:00
|
|
|
int PyMethod_ClearFreeList(void);
|
2021-08-08 04:08:33 +00:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
PyObject_HEAD
|
|
|
|
PyObject *func;
|
|
|
|
} PyInstanceMethodObject;
|
|
|
|
|
2021-08-12 07:42:14 +00:00
|
|
|
extern PyTypeObject PyInstanceMethod_Type;
|
2021-08-08 04:08:33 +00:00
|
|
|
|
|
|
|
#define PyInstanceMethod_Check(op) ((op)->ob_type == &PyInstanceMethod_Type)
|
|
|
|
|
2021-08-12 07:42:14 +00:00
|
|
|
PyObject * PyInstanceMethod_New(PyObject *);
|
|
|
|
PyObject * PyInstanceMethod_Function(PyObject *);
|
2021-08-08 04:08:33 +00:00
|
|
|
|
|
|
|
/* Macros for direct access to these values. Type checks are *not*
|
|
|
|
done, so use with care. */
|
|
|
|
#define PyInstanceMethod_GET_FUNCTION(meth) \
|
|
|
|
(((PyInstanceMethodObject *)meth) -> func)
|
|
|
|
|
2021-08-10 17:26:13 +00:00
|
|
|
COSMOPOLITAN_C_END_
|
2021-08-08 04:08:33 +00:00
|
|
|
#endif /* !Py_CLASSOBJECT_H */
|
|
|
|
#endif /* Py_LIMITED_API */
|