summaryrefslogtreecommitdiffstats
path: root/Modules/xxmodule.c
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2007-07-21 06:55:02 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2007-07-21 06:55:02 (GMT)
commit6819210b9e4e5719a6f7f9c1725f8fa70a8936f6 (patch)
tree456e2e6b3d9d71e966f3b0e419ecfe44ce3c1fdd /Modules/xxmodule.c
parentb1994b4a5d0139a010eb0af1d6615a3df92fe786 (diff)
downloadcpython-6819210b9e4e5719a6f7f9c1725f8fa70a8936f6.zip
cpython-6819210b9e4e5719a6f7f9c1725f8fa70a8936f6.tar.gz
cpython-6819210b9e4e5719a6f7f9c1725f8fa70a8936f6.tar.bz2
PEP 3123: Provide forward compatibility with Python 3.0, while keeping
backwards compatibility. Add Py_Refcnt, Py_Type, Py_Size, and PyVarObject_HEAD_INIT.
Diffstat (limited to 'Modules/xxmodule.c')
-rw-r--r--Modules/xxmodule.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/Modules/xxmodule.c b/Modules/xxmodule.c
index ea66eef..0923f81 100644
--- a/Modules/xxmodule.c
+++ b/Modules/xxmodule.c
@@ -25,7 +25,7 @@ typedef struct {
static PyTypeObject Xxo_Type;
-#define XxoObject_Check(v) ((v)->ob_type == &Xxo_Type)
+#define XxoObject_Check(v) (Py_Type(v) == &Xxo_Type)
static XxoObject *
newXxoObject(PyObject *arg)
@@ -97,8 +97,7 @@ Xxo_setattr(XxoObject *self, char *name, PyObject *v)
static PyTypeObject Xxo_Type = {
/* The ob_type field must be initialized in the module init function
* to be portable to Windows without using C++. */
- PyObject_HEAD_INIT(NULL)
- 0, /*ob_size*/
+ PyVarObject_HEAD_INIT(NULL, 0)
"xxmodule.Xxo", /*tp_name*/
sizeof(XxoObject), /*tp_basicsize*/
0, /*tp_itemsize*/
@@ -216,8 +215,7 @@ xx_roj(PyObject *self, PyObject *args)
static PyTypeObject Str_Type = {
/* The ob_type field must be initialized in the module init function
* to be portable to Windows without using C++. */
- PyObject_HEAD_INIT(NULL)
- 0, /*ob_size*/
+ PyVarObject_HEAD_INIT(NULL, 0)
"xxmodule.Str", /*tp_name*/
0, /*tp_basicsize*/
0, /*tp_itemsize*/
@@ -272,8 +270,7 @@ null_richcompare(PyObject *self, PyObject *other, int op)
static PyTypeObject Null_Type = {
/* The ob_type field must be initialized in the module init function
* to be portable to Windows without using C++. */
- PyObject_HEAD_INIT(NULL)
- 0, /*ob_size*/
+ PyVarObject_HEAD_INIT(NULL, 0)
"xxmodule.Null", /*tp_name*/
0, /*tp_basicsize*/
0, /*tp_itemsize*/