diff options
Diffstat (limited to 'Include/structseq.h')
-rw-r--r-- | Include/structseq.h | 38 |
1 files changed, 15 insertions, 23 deletions
diff --git a/Include/structseq.h b/Include/structseq.h index 8f51c89..e662916 100644 --- a/Include/structseq.h +++ b/Include/structseq.h @@ -1,5 +1,5 @@ -/* Named tuple object interface */ +/* Tuple object interface */ #ifndef Py_STRUCTSEQ_H #define Py_STRUCTSEQ_H @@ -8,40 +8,32 @@ extern "C" { #endif typedef struct PyStructSequence_Field { - const char *name; - const char *doc; + char *name; + char *doc; } PyStructSequence_Field; typedef struct PyStructSequence_Desc { - const char *name; - const char *doc; - struct PyStructSequence_Field *fields; - int n_in_sequence; + char *name; + char *doc; + struct PyStructSequence_Field *fields; + int n_in_sequence; } PyStructSequence_Desc; -extern const char * const PyStructSequence_UnnamedField; +extern char* PyStructSequence_UnnamedField; -#ifndef Py_LIMITED_API PyAPI_FUNC(void) PyStructSequence_InitType(PyTypeObject *type, - PyStructSequence_Desc *desc); -PyAPI_FUNC(int) PyStructSequence_InitType2(PyTypeObject *type, - PyStructSequence_Desc *desc); -#endif -PyAPI_FUNC(PyTypeObject*) PyStructSequence_NewType(PyStructSequence_Desc *desc); + PyStructSequence_Desc *desc); PyAPI_FUNC(PyObject *) PyStructSequence_New(PyTypeObject* type); -#ifndef Py_LIMITED_API -typedef PyTupleObject PyStructSequence; +typedef struct { + PyObject_VAR_HEAD + PyObject *ob_item[1]; +} PyStructSequence; /* Macro, *only* to be used to fill in brand new objects */ -#define PyStructSequence_SET_ITEM(op, i, v) PyTuple_SET_ITEM(op, i, v) - -#define PyStructSequence_GET_ITEM(op, i) PyTuple_GET_ITEM(op, i) -#endif - -PyAPI_FUNC(void) PyStructSequence_SetItem(PyObject*, Py_ssize_t, PyObject*); -PyAPI_FUNC(PyObject*) PyStructSequence_GetItem(PyObject*, Py_ssize_t); +#define PyStructSequence_SET_ITEM(op, i, v) \ + (((PyStructSequence *)(op))->ob_item[i] = v) #ifdef __cplusplus } |