diff options
author | Panu Matilainen <Panu Matilainen pmatilai@redhat.com> | 2011-07-06 08:16:12 +0300 |
---|---|---|
committer | Panu Matilainen <Panu Matilainen pmatilai@redhat.com> | 2011-07-06 08:16:12 +0300 |
commit | a71a7981cc9f7c8f107e5a14c51e1963375da5b8 (patch) | |
tree | 7989ed773ac6bc56c98193d2e5b89a31542e81cc /python/rpmds-py.c | |
parent | ba2401f74620618ee7d3161888be71328f6e3c4c (diff) | |
download | librpm-tizen-a71a7981cc9f7c8f107e5a14c51e1963375da5b8.tar.gz librpm-tizen-a71a7981cc9f7c8f107e5a14c51e1963375da5b8.tar.bz2 librpm-tizen-a71a7981cc9f7c8f107e5a14c51e1963375da5b8.zip |
Revert the ds, ts, fi and spec python object creation commits
- Hasty push-finger syndrom, while its not exactly plain wrong to
do things this way, it doesn't really make sense for these types
either. Python's own file object permits reinitialization though,
so leaving rpm.fd() the way it is now.
- This reverts the following commits:
d056df28c38e602d82b4f9b527c686037074e660
3f77c3146da46a49f44b17fa66139fbe2dd9e45c
7214b2e0a271b7a7b3df312c58593878cbf56504
dc50fb2863c81159fb4cc8b25ce3862720c0cce5
Diffstat (limited to 'python/rpmds-py.c')
-rw-r--r-- | python/rpmds-py.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/python/rpmds-py.c b/python/rpmds-py.c index 4fb0fb323..30fb908fb 100644 --- a/python/rpmds-py.c +++ b/python/rpmds-py.c @@ -254,6 +254,12 @@ static PyMappingMethods rpmds_as_mapping = { (objobjargproc)0, /* mp_ass_subscript */ }; +static int rpmds_init(rpmdsObject * s, PyObject *args, PyObject *kwds) +{ + s->active = 0; + return 0; +} + static int depflags(PyObject *o, rpmsenseFlags *senseFlags) { int ok = 0; @@ -293,7 +299,7 @@ static int depflags(PyObject *o, rpmsenseFlags *senseFlags) return ok; } -static int rpmds_init(rpmdsObject *s, PyObject *args, PyObject *kwds) +static PyObject * rpmds_new(PyTypeObject * subtype, PyObject *args, PyObject *kwds) { PyObject *obj; rpmTagVal tagN = RPMTAG_REQUIRENAME; @@ -303,7 +309,7 @@ static int rpmds_init(rpmdsObject *s, PyObject *args, PyObject *kwds) if (!PyArg_ParseTupleAndKeywords(args, kwds, "OO&:rpmds_new", kwlist, &obj, tagNumFromPyObject, &tagN)) - return -1; + return NULL; if (PyTuple_Check(obj)) { const char *name = NULL; @@ -314,7 +320,7 @@ static int rpmds_init(rpmdsObject *s, PyObject *args, PyObject *kwds) ds = rpmdsSingle(tagN, name, evr, flags); } else { PyErr_SetString(PyExc_ValueError, "invalid dependency tuple"); - return -1; + return NULL; } } else if (hdrFromPyObject(obj, &h)) { if (tagN == RPMTAG_NEVR) { @@ -324,14 +330,10 @@ static int rpmds_init(rpmdsObject *s, PyObject *args, PyObject *kwds) } } else { PyErr_SetString(PyExc_TypeError, "header or tuple expected"); - return -1; + return NULL; } - - rpmdsFree(s->ds); - s->ds = ds; - s->active = 0; - - return 0; + + return rpmds_Wrap(subtype, ds); } static char rpmds_doc[] = @@ -376,7 +378,7 @@ PyTypeObject rpmds_Type = { 0, /* tp_dictoffset */ (initproc) rpmds_init, /* tp_init */ 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ + (newfunc) rpmds_new, /* tp_new */ 0, /* tp_free */ 0, /* tp_is_gc */ }; |