diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2009-09-23 10:44:41 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2009-09-23 10:44:41 +0300 |
commit | c29492242c97ebed80bdf561c4a15acf9d7939ca (patch) | |
tree | dae43e98108095c3f06005270da91181607e3fea /python | |
parent | 6bbc19fb228465215b59cd2c902564d7665ce554 (diff) | |
download | rpm-c29492242c97ebed80bdf561c4a15acf9d7939ca.tar.gz rpm-c29492242c97ebed80bdf561c4a15acf9d7939ca.tar.bz2 rpm-c29492242c97ebed80bdf561c4a15acf9d7939ca.zip |
Remove tp_print methods from all rpm-python objects
- these violate the intended use of tp_print, python docs state
"A type should never implement tp_print in a way that produces
different output than tp_repr or tp_str would."
Diffstat (limited to 'python')
-rw-r--r-- | python/rpmds-py.c | 14 | ||||
-rw-r--r-- | python/rpmfi-py.c | 14 | ||||
-rw-r--r-- | python/rpmps-py.c | 10 | ||||
-rw-r--r-- | python/rpmte-py.c | 17 |
4 files changed, 4 insertions, 51 deletions
diff --git a/python/rpmds-py.c b/python/rpmds-py.c index 930eb4d4c..fe0e164a5 100644 --- a/python/rpmds-py.c +++ b/python/rpmds-py.c @@ -386,18 +386,6 @@ rpmds_dealloc(rpmdsObject * s) } static int -rpmds_print(rpmdsObject * s, FILE * fp, int flags) -{ - if (!(s && s->ds)) - return -1; - - s->ds = rpmdsInit(s->ds); - while (rpmdsNext(s->ds) >= 0) - fprintf(fp, "%s\n", rpmdsDNEVR(s->ds)); - return 0; -} - -static int rpmds_length(rpmdsObject * s) { return rpmdsCount(s->ds); @@ -470,7 +458,7 @@ PyTypeObject rpmds_Type = { 0, /* tp_itemsize */ /* methods */ (destructor) rpmds_dealloc, /* tp_dealloc */ - (printfunc) rpmds_print, /* tp_print */ + 0, /* tp_print */ (getattrfunc)0, /* tp_getattr */ (setattrfunc)0, /* tp_setattr */ (cmpfunc) rpmds_compare, /* tp_compare */ diff --git a/python/rpmfi-py.c b/python/rpmfi-py.c index 20be11979..f1ab3a8de 100644 --- a/python/rpmfi-py.c +++ b/python/rpmfi-py.c @@ -264,18 +264,6 @@ rpmfi_dealloc(rpmfiObject * s) } static int -rpmfi_print(rpmfiObject * s, FILE * fp, int flags) -{ - if (!(s && s->fi)) - return -1; - - s->fi = rpmfiInit(s->fi, 0); - while (rpmfiNext(s->fi) >= 0) - fprintf(fp, "%s\n", rpmfiFN(s->fi)); - return 0; -} - -static int rpmfi_length(rpmfiObject * s) { return rpmfiFC(s->fi); @@ -348,7 +336,7 @@ PyTypeObject rpmfi_Type = { 0, /* tp_itemsize */ /* methods */ (destructor) rpmfi_dealloc, /* tp_dealloc */ - (printfunc) rpmfi_print, /* tp_print */ + 0, /* tp_print */ (getattrfunc)0, /* tp_getattr */ (setattrfunc)0, /* tp_setattr */ (cmpfunc)0, /* tp_compare */ diff --git a/python/rpmps-py.c b/python/rpmps-py.c index 7e0ad9976..2adbdeb60 100644 --- a/python/rpmps-py.c +++ b/python/rpmps-py.c @@ -68,14 +68,6 @@ rpmps_dealloc(rpmpsObject * s) } static int -rpmps_print(rpmpsObject * s, FILE * fp, int flags) -{ - if (s && s->ps) - rpmpsPrint(fp, s->ps); - return 0; -} - -static int rpmps_length(rpmpsObject * s) { int rc; @@ -141,7 +133,7 @@ PyTypeObject rpmps_Type = { 0, /* tp_itemsize */ /* methods */ (destructor) rpmps_dealloc, /* tp_dealloc */ - (printfunc) rpmps_print, /* tp_print */ + 0, /* tp_print */ (getattrfunc)0, /* tp_getattr */ (setattrfunc)0, /* tp_setattr */ (cmpfunc)0, /* tp_compare */ diff --git a/python/rpmte-py.c b/python/rpmte-py.c index 5fe7e2517..2187cea1e 100644 --- a/python/rpmte-py.c +++ b/python/rpmte-py.c @@ -261,21 +261,6 @@ static struct PyMethodDef rpmte_methods[] = { /* ---------- */ -static int -rpmte_print(rpmteObject * s, FILE * fp, int flags) -{ - const char * tstr; - if (!(s && s->te)) - return -1; - switch (rpmteType(s->te)) { - case TR_ADDED: tstr = "++"; break; - case TR_REMOVED: tstr = "--"; break; - default: tstr = "??"; break; - } - fprintf(fp, "%s %s %s", tstr, rpmteNEVR(s->te), rpmteA(s->te)); - return 0; -} - static char rpmte_doc[] = ""; @@ -286,7 +271,7 @@ PyTypeObject rpmte_Type = { sizeof(rpmteObject), /* tp_size */ 0, /* tp_itemsize */ (destructor)0, /* tp_dealloc */ - (printfunc) rpmte_print, /* tp_print */ + 0, /* tp_print */ (getattrfunc)0, /* tp_getattr */ (setattrfunc)0, /* tp_setattr */ 0, /* tp_compare */ |