Mercurial > cpython-lru_cache-weakref
diff Include/methodobject.h @ 8656:9e536dd3dc97 legacy-trunk
Marc-Andre Lemburg's patch to move the typedef for PyCFunctionObject
to the .h file and add macros there for inlined access to the fields.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Fri, 10 Jul 1998 15:21:55 +0000 |
| parents | 65d2d8e67da3 |
| children | 60fdb1db1175 |
line wrap: on
line diff
--- a/Include/methodobject.h Thu Jul 09 13:52:38 1998 +0000 +++ b/Include/methodobject.h Fri Jul 10 15:21:55 1998 +0000 @@ -49,6 +49,15 @@ extern PyObject *PyCFunction_GetSelf Py_PROTO((PyObject *)); extern int PyCFunction_GetFlags Py_PROTO((PyObject *)); +/* Macros for direct access to these values. Type checks are *not* + done, so use with care. */ +#define PyCFunction_GET_FUNCTION(func) \ + (((PyCFunctionObject *)func) -> m_ml -> ml_meth) +#define PyCFunction_GET_SELF(func) \ + (((PyCFunctionObject *)func) -> m_self) +#define PyCFunction_GET_FLAGS(func) \ + (((PyCFunctionObject *)func) -> m_ml -> ml_flags) + struct PyMethodDef { char *ml_name; PyCFunction ml_meth; @@ -75,6 +84,12 @@ extern PyObject *Py_FindMethodInChain Py_PROTO((PyMethodChain *, PyObject *, char *)); +typedef struct { + PyObject_HEAD + PyMethodDef *m_ml; + PyObject *m_self; +} PyCFunctionObject; + #ifdef __cplusplus } #endif
