mirror of
https://github.com/python/cpython.git
synced 2025-10-10 00:43:41 +00:00
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.
This commit is contained in:
parent
eeb64287f1
commit
9223351617
2 changed files with 15 additions and 6 deletions
|
@ -49,6 +49,15 @@ extern PyCFunction PyCFunction_GetFunction Py_PROTO((PyObject *));
|
||||||
extern PyObject *PyCFunction_GetSelf Py_PROTO((PyObject *));
|
extern PyObject *PyCFunction_GetSelf Py_PROTO((PyObject *));
|
||||||
extern int PyCFunction_GetFlags 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 {
|
struct PyMethodDef {
|
||||||
char *ml_name;
|
char *ml_name;
|
||||||
PyCFunction ml_meth;
|
PyCFunction ml_meth;
|
||||||
|
@ -75,6 +84,12 @@ typedef struct PyMethodChain {
|
||||||
extern PyObject *Py_FindMethodInChain
|
extern PyObject *Py_FindMethodInChain
|
||||||
Py_PROTO((PyMethodChain *, PyObject *, char *));
|
Py_PROTO((PyMethodChain *, PyObject *, char *));
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
PyObject_HEAD
|
||||||
|
PyMethodDef *m_ml;
|
||||||
|
PyObject *m_self;
|
||||||
|
} PyCFunctionObject;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -35,12 +35,6 @@ PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
#include "token.h"
|
#include "token.h"
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
PyObject_HEAD
|
|
||||||
PyMethodDef *m_ml;
|
|
||||||
PyObject *m_self;
|
|
||||||
} PyCFunctionObject;
|
|
||||||
|
|
||||||
static PyCFunctionObject *free_list = NULL;
|
static PyCFunctionObject *free_list = NULL;
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue