diff options
author | Guido van Rossum <guido@python.org> | 1998-07-10 15:21:55 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1998-07-10 15:21:55 (GMT) |
commit | 9223351617793f0674b8410d39ff5437b2a29879 (patch) | |
tree | a629f43451c809259405cfef06fac3c38171ea3b /Include/methodobject.h | |
parent | eeb64287f1e735ead3eced61804cca81452cff79 (diff) | |
download | cpython-9223351617793f0674b8410d39ff5437b2a29879.zip cpython-9223351617793f0674b8410d39ff5437b2a29879.tar.gz cpython-9223351617793f0674b8410d39ff5437b2a29879.tar.bz2 |
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.
Diffstat (limited to 'Include/methodobject.h')
-rw-r--r-- | Include/methodobject.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Include/methodobject.h b/Include/methodobject.h index 2d557c5..2b4819f 100644 --- a/Include/methodobject.h +++ b/Include/methodobject.h @@ -49,6 +49,15 @@ extern PyCFunction PyCFunction_GetFunction Py_PROTO((PyObject *)); 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 @@ typedef struct PyMethodChain { extern PyObject *Py_FindMethodInChain Py_PROTO((PyMethodChain *, PyObject *, char *)); +typedef struct { + PyObject_HEAD + PyMethodDef *m_ml; + PyObject *m_self; +} PyCFunctionObject; + #ifdef __cplusplus } #endif |