summaryrefslogtreecommitdiff
path: root/python/rpmps-py.c
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2009-09-24 11:42:17 +0300
committerPanu Matilainen <pmatilai@redhat.com>2009-09-24 11:42:17 +0300
commit36ada6c116e123f5b5b739e12f256201e5cc6fa1 (patch)
tree6f4cb506966ff356c975010caf816c6a70436424 /python/rpmps-py.c
parentab66c9ff47664fcfae6eea2146be65ccbff43195 (diff)
downloadlibrpm-tizen-36ada6c116e123f5b5b739e12f256201e5cc6fa1.tar.gz
librpm-tizen-36ada6c116e123f5b5b739e12f256201e5cc6fa1.tar.bz2
librpm-tizen-36ada6c116e123f5b5b739e12f256201e5cc6fa1.zip
Make object allocation type agnostic
- pass (sub)type down to wrappers - call subtype tp_alloc() instead of PyObject_New() - preliminaries for allowing subtyping
Diffstat (limited to 'python/rpmps-py.c')
-rw-r--r--python/rpmps-py.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/python/rpmps-py.c b/python/rpmps-py.c
index 2adbdeb60..82422c0d1 100644
--- a/python/rpmps-py.c
+++ b/python/rpmps-py.c
@@ -119,7 +119,7 @@ static void rpmps_free(rpmpsObject * s)
static PyObject * rpmps_new(PyTypeObject * subtype, PyObject *args, PyObject *kwds)
{
rpmps ps = rpmpsCreate();
- return rpmps_Wrap(ps);
+ return rpmps_Wrap(subtype, ps);
}
static char rpmps_doc[] =
@@ -175,9 +175,9 @@ rpmps psFromPs(rpmpsObject * s)
return s->ps;
}
-PyObject * rpmps_Wrap(rpmps ps)
+PyObject * rpmps_Wrap(PyTypeObject *subtype, rpmps ps)
{
- rpmpsObject * s = PyObject_New(rpmpsObject, &rpmps_Type);
+ rpmpsObject * s = (rpmpsObject *)subtype->tp_alloc(subtype, 0);
if (s == NULL) return PyErr_NoMemory();
s->ps = ps; /* XXX refcounts? */