summaryrefslogtreecommitdiff
path: root/python/rpmds-py.c
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2009-10-15 15:14:56 -0400
committerPanu Matilainen <pmatilai@redhat.com>2009-10-19 10:50:24 +0300
commit7b51c4a1eb8f14207f9a8d3e0be514a41c0e2197 (patch)
tree0ae6fd661d3c7a2142a1e3675b10c7f2c29588af /python/rpmds-py.c
parent63175d4d31469816c575ddb4de9698fb5c053536 (diff)
downloadrpm-7b51c4a1eb8f14207f9a8d3e0be514a41c0e2197.tar.gz
rpm-7b51c4a1eb8f14207f9a8d3e0be514a41c0e2197.tar.bz2
rpm-7b51c4a1eb8f14207f9a8d3e0be514a41c0e2197.zip
Generalize access to ob_type so that they work with both Python 2.* and Python 3.*
Python 2's various object structs use macros to implement common fields at the top of each struct. Python 3's objects instead embed a PyObject struct as the first member within the more refined object structs. Use the Py_TYPE() macro when accessing ob_type in order to encapsulate this difference.
Diffstat (limited to 'python/rpmds-py.c')
-rw-r--r--python/rpmds-py.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/python/rpmds-py.c b/python/rpmds-py.c
index 71ef93fde..8938cc7a1 100644
--- a/python/rpmds-py.c
+++ b/python/rpmds-py.c
@@ -199,7 +199,7 @@ rpmds_iternext(rpmdsObject * s)
rpmTag tagN = rpmdsTagN(s->ds);
rpmsenseFlags Flags = rpmdsFlags(s->ds);
- result = rpmds_Wrap(s->ob_type, rpmdsSingle(tagN, N, EVR, Flags) );
+ result = rpmds_Wrap(Py_TYPE(s), rpmdsSingle(tagN, N, EVR, Flags) );
} else
s->active = 0;
@@ -381,7 +381,7 @@ static void
rpmds_dealloc(rpmdsObject * s)
{
s->ds = rpmdsFree(s->ds);
- s->ob_type->tp_free((PyObject *)s);
+ Py_TYPE(s)->tp_free((PyObject *)s);
}
static Py_ssize_t rpmds_length(rpmdsObject * s)