diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2009-09-22 21:53:21 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2009-09-22 21:53:21 +0300 |
commit | 864220c441704e3d61fa521c682a23874b41e4ba (patch) | |
tree | 074a4145961da5eae5857e5b6e1cc1b171cce463 /python/rpmps-py.c | |
parent | ed557bbcf065905beebb42d50048cecf04c3e441 (diff) | |
download | librpm-tizen-864220c441704e3d61fa521c682a23874b41e4ba.tar.gz librpm-tizen-864220c441704e3d61fa521c682a23874b41e4ba.tar.bz2 librpm-tizen-864220c441704e3d61fa521c682a23874b41e4ba.zip |
Put some consistency to python object creation
- all type object creation goes through foo_Wrap() which handle OOM
and all type specific initialization
Diffstat (limited to 'python/rpmps-py.c')
-rw-r--r-- | python/rpmps-py.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/python/rpmps-py.c b/python/rpmps-py.c index 408234ce2..652d83b6c 100644 --- a/python/rpmps-py.c +++ b/python/rpmps-py.c @@ -165,15 +165,8 @@ fprintf(stderr, "%p -- ps %p\n", s, s->ps); */ static PyObject * rpmps_new(PyTypeObject * subtype, PyObject *args, PyObject *kwds) { - rpmpsObject * s = (void *) PyObject_New(rpmpsObject, subtype); - - s->ps = rpmpsCreate(); - s->psi = NULL; - -if (_rpmps_debug) -fprintf(stderr, "%p ++ ps %p\n", s, s->ps); - - return (PyObject *)s; + rpmps ps = rpmpsCreate(); + return rpmps_Wrap(ps); } /** @@ -236,10 +229,9 @@ rpmps psFromPs(rpmpsObject * s) PyObject * rpmps_Wrap(rpmps ps) { rpmpsObject * s = PyObject_New(rpmpsObject, &rpmps_Type); + if (s == NULL) return PyErr_NoMemory(); - if (s == NULL) - return NULL; - s->ps = ps; + s->ps = ps; /* XXX refcounts? */ s->psi = NULL; return (PyObject *) s; } |