diff options
Diffstat (limited to 'Modules/_struct.c')
-rw-r--r-- | Modules/_struct.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/Modules/_struct.c b/Modules/_struct.c index 3100982..84aa828 100644 --- a/Modules/_struct.c +++ b/Modules/_struct.c @@ -72,7 +72,7 @@ typedef struct { #define PyStruct_Check(op) PyObject_TypeCheck(op, &PyStructType) -#define PyStruct_CheckExact(op) ((op)->ob_type == &PyStructType) +#define PyStruct_CheckExact(op) (Py_Type(op) == &PyStructType) /* Exception */ @@ -131,7 +131,7 @@ get_pylong(PyObject *v) Py_INCREF(v); return v; } - m = v->ob_type->tp_as_number; + m = Py_Type(v)->tp_as_number; if (m != NULL && m->nb_long != NULL) { v = m->nb_long(v); if (v == NULL) @@ -1490,7 +1490,7 @@ s_dealloc(PyStructObject *s) PyMem_FREE(s->s_codes); } Py_XDECREF(s->s_format); - s->ob_type->tp_free((PyObject *)s); + Py_Type(s)->tp_free((PyObject *)s); } static PyObject * @@ -1839,8 +1839,7 @@ static PyGetSetDef s_getsetlist[] = { static PyTypeObject PyStructType = { - PyObject_HEAD_INIT(NULL) - 0, + PyVarObject_HEAD_INIT(NULL, 0) "Struct", sizeof(PyStructObject), 0, @@ -1890,7 +1889,7 @@ init_struct(void) if (m == NULL) return; - PyStructType.ob_type = &PyType_Type; + Py_Type(&PyStructType) = &PyType_Type; if (PyType_Ready(&PyStructType) < 0) return; |