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 ee938d6..36e64be 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 */ @@ -133,7 +133,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) @@ -1487,7 +1487,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 * @@ -1806,8 +1806,7 @@ static PyGetSetDef s_getsetlist[] = { static PyTypeObject PyStructType = { - PyObject_HEAD_INIT(NULL) - 0, + PyVarObject_HEAD_INIT(NULL, 0) "Struct", sizeof(PyStructObject), 0, @@ -1857,7 +1856,7 @@ init_struct(void) if (m == NULL) return; - PyStructType.ob_type = &PyType_Type; + Py_Type(&PyStructType) = &PyType_Type; if (PyType_Ready(&PyStructType) < 0) return; |