• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 
2 /* Named tuple object interface */
3 
4 #ifndef Py_STRUCTSEQ_H
5 #define Py_STRUCTSEQ_H
6 #ifdef __cplusplus
7 extern "C" {
8 #endif
9 
10 typedef struct PyStructSequence_Field {
11     const char *name;
12     const char *doc;
13 } PyStructSequence_Field;
14 
15 typedef struct PyStructSequence_Desc {
16     const char *name;
17     const char *doc;
18     PyStructSequence_Field *fields;
19     int n_in_sequence;
20 } PyStructSequence_Desc;
21 
22 PyAPI_DATA(const char * const) PyStructSequence_UnnamedField;
23 
24 #ifndef Py_LIMITED_API
25 PyAPI_FUNC(void) PyStructSequence_InitType(PyTypeObject *type,
26                                            PyStructSequence_Desc *desc);
27 PyAPI_FUNC(int) PyStructSequence_InitType2(PyTypeObject *type,
28                                            PyStructSequence_Desc *desc);
29 #endif
30 PyAPI_FUNC(PyTypeObject*) PyStructSequence_NewType(PyStructSequence_Desc *desc);
31 
32 PyAPI_FUNC(PyObject *) PyStructSequence_New(PyTypeObject* type);
33 
34 PyAPI_FUNC(void) PyStructSequence_SetItem(PyObject*, Py_ssize_t, PyObject*);
35 PyAPI_FUNC(PyObject*) PyStructSequence_GetItem(PyObject*, Py_ssize_t);
36 
37 #ifndef Py_LIMITED_API
38 typedef PyTupleObject PyStructSequence;
39 #define PyStructSequence_SET_ITEM PyStructSequence_SetItem
40 #define PyStructSequence_GET_ITEM PyStructSequence_GetItem
41 #endif
42 
43 #ifdef __cplusplus
44 }
45 #endif
46 #endif /* !Py_STRUCTSEQ_H */
47