Commit 23ed1a34 authored by Boxiang Sun's avatar Boxiang Sun

some Pyston change to structseq

parent df3e7ee9
...@@ -8,14 +8,15 @@ ...@@ -8,14 +8,15 @@
extern "C" { extern "C" {
#endif #endif
// Pyston changes: change char* to const char*
typedef struct PyStructSequence_Field { typedef struct PyStructSequence_Field {
char *name; const char *name;
char *doc; const char *doc;
} PyStructSequence_Field; } PyStructSequence_Field;
typedef struct PyStructSequence_Desc { typedef struct PyStructSequence_Desc {
char *name; const char *name;
char *doc; const char *doc;
struct PyStructSequence_Field *fields; struct PyStructSequence_Field *fields;
int n_in_sequence; int n_in_sequence;
} PyStructSequence_Desc; } PyStructSequence_Desc;
...@@ -25,7 +26,8 @@ extern char* PyStructSequence_UnnamedField; ...@@ -25,7 +26,8 @@ extern char* PyStructSequence_UnnamedField;
PyAPI_FUNC(void) PyStructSequence_InitType(PyTypeObject *type, PyAPI_FUNC(void) PyStructSequence_InitType(PyTypeObject *type,
PyStructSequence_Desc *desc) PYSTON_NOEXCEPT; PyStructSequence_Desc *desc) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyStructSequence_New(PyTypeObject* type) PYSTON_NOEXCEPT; // Pyston change, change PyTypeObject to struct _typeobject
PyAPI_FUNC(PyObject *) PyStructSequence_New(struct _typeobject* type) PYSTON_NOEXCEPT;
typedef struct { typedef struct {
PyObject_VAR_HEAD PyObject_VAR_HEAD
......
...@@ -519,12 +519,12 @@ PyStructSequence_InitType(PyTypeObject *type, PyStructSequence_Desc *desc) ...@@ -519,12 +519,12 @@ PyStructSequence_InitType(PyTypeObject *type, PyStructSequence_Desc *desc)
for (i = k = 0; i < n_members; ++i) { for (i = k = 0; i < n_members; ++i) {
if (desc->fields[i].name == PyStructSequence_UnnamedField) if (desc->fields[i].name == PyStructSequence_UnnamedField)
continue; continue;
members[k].name = desc->fields[i].name; members[k].name = (char*)desc->fields[i].name;
members[k].type = T_OBJECT; members[k].type = T_OBJECT;
members[k].offset = offsetof(PyStructSequence, ob_item) members[k].offset = offsetof(PyStructSequence, ob_item)
+ i * sizeof(PyObject*); + i * sizeof(PyObject*);
members[k].flags = READONLY; members[k].flags = READONLY;
members[k].doc = desc->fields[i].doc; members[k].doc = (char*)desc->fields[i].doc;
k++; k++;
} }
members[k].name = NULL; members[k].name = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment