summaryrefslogtreecommitdiffstats
path: root/Modules/bz2module.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/bz2module.c')
-rw-r--r--Modules/bz2module.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/Modules/bz2module.c b/Modules/bz2module.c
index 9d92cf6..053461f 100644
--- a/Modules/bz2module.c
+++ b/Modules/bz2module.c
@@ -41,7 +41,7 @@ typedef fpos_t Py_off_t;
#define MODE_READ_EOF 2
#define MODE_WRITE 3
-#define BZ2FileObject_Check(v) ((v)->ob_type == &BZ2File_Type)
+#define BZ2FileObject_Check(v) (Py_Type(v) == &BZ2File_Type)
#ifdef BZ_CONFIG_ERROR
@@ -1418,7 +1418,7 @@ BZ2File_dealloc(BZ2FileObject *self)
}
Util_DropReadAhead(self);
Py_XDECREF(self->file);
- self->ob_type->tp_free((PyObject *)self);
+ Py_Type(self)->tp_free((PyObject *)self);
}
/* This is a hacked version of Python's fileobject.c:file_getiter(). */
@@ -1480,8 +1480,7 @@ newlines are available only when reading.\n\
;
static PyTypeObject BZ2File_Type = {
- PyObject_HEAD_INIT(NULL)
- 0, /*ob_size*/
+ PyVarObject_HEAD_INIT(NULL, 0)
"bz2.BZ2File", /*tp_name*/
sizeof(BZ2FileObject), /*tp_basicsize*/
0, /*tp_itemsize*/
@@ -1735,7 +1734,7 @@ BZ2Comp_dealloc(BZ2CompObject *self)
PyThread_free_lock(self->lock);
#endif
BZ2_bzCompressEnd(&self->bzs);
- self->ob_type->tp_free((PyObject *)self);
+ Py_Type(self)->tp_free((PyObject *)self);
}
@@ -1752,8 +1751,7 @@ must be a number between 1 and 9.\n\
");
static PyTypeObject BZ2Comp_Type = {
- PyObject_HEAD_INIT(NULL)
- 0, /*ob_size*/
+ PyVarObject_HEAD_INIT(NULL, 0)
"bz2.BZ2Compressor", /*tp_name*/
sizeof(BZ2CompObject), /*tp_basicsize*/
0, /*tp_itemsize*/
@@ -1958,7 +1956,7 @@ BZ2Decomp_dealloc(BZ2DecompObject *self)
#endif
Py_XDECREF(self->unused_data);
BZ2_bzDecompressEnd(&self->bzs);
- self->ob_type->tp_free((PyObject *)self);
+ Py_Type(self)->tp_free((PyObject *)self);
}
@@ -1974,8 +1972,7 @@ decompress() function instead.\n\
");
static PyTypeObject BZ2Decomp_Type = {
- PyObject_HEAD_INIT(NULL)
- 0, /*ob_size*/
+ PyVarObject_HEAD_INIT(NULL, 0)
"bz2.BZ2Decompressor", /*tp_name*/
sizeof(BZ2DecompObject), /*tp_basicsize*/
0, /*tp_itemsize*/
@@ -2209,9 +2206,9 @@ initbz2(void)
{
PyObject *m;
- BZ2File_Type.ob_type = &PyType_Type;
- BZ2Comp_Type.ob_type = &PyType_Type;
- BZ2Decomp_Type.ob_type = &PyType_Type;
+ Py_Type(&BZ2File_Type) = &PyType_Type;
+ Py_Type(&BZ2Comp_Type) = &PyType_Type;
+ Py_Type(&BZ2Decomp_Type) = &PyType_Type;
m = Py_InitModule3("bz2", bz2_methods, bz2__doc__);
if (m == NULL)