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."
This commit is contained in:
parent
6bbc19fb22
commit
c29492242c
|
@ -385,18 +385,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
|
static int
|
||||||
rpmds_length(rpmdsObject * s)
|
rpmds_length(rpmdsObject * s)
|
||||||
{
|
{
|
||||||
|
@ -470,7 +458,7 @@ PyTypeObject rpmds_Type = {
|
||||||
0, /* tp_itemsize */
|
0, /* tp_itemsize */
|
||||||
/* methods */
|
/* methods */
|
||||||
(destructor) rpmds_dealloc, /* tp_dealloc */
|
(destructor) rpmds_dealloc, /* tp_dealloc */
|
||||||
(printfunc) rpmds_print, /* tp_print */
|
0, /* tp_print */
|
||||||
(getattrfunc)0, /* tp_getattr */
|
(getattrfunc)0, /* tp_getattr */
|
||||||
(setattrfunc)0, /* tp_setattr */
|
(setattrfunc)0, /* tp_setattr */
|
||||||
(cmpfunc) rpmds_compare, /* tp_compare */
|
(cmpfunc) rpmds_compare, /* tp_compare */
|
||||||
|
|
|
@ -263,18 +263,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
|
static int
|
||||||
rpmfi_length(rpmfiObject * s)
|
rpmfi_length(rpmfiObject * s)
|
||||||
{
|
{
|
||||||
|
@ -348,7 +336,7 @@ PyTypeObject rpmfi_Type = {
|
||||||
0, /* tp_itemsize */
|
0, /* tp_itemsize */
|
||||||
/* methods */
|
/* methods */
|
||||||
(destructor) rpmfi_dealloc, /* tp_dealloc */
|
(destructor) rpmfi_dealloc, /* tp_dealloc */
|
||||||
(printfunc) rpmfi_print, /* tp_print */
|
0, /* tp_print */
|
||||||
(getattrfunc)0, /* tp_getattr */
|
(getattrfunc)0, /* tp_getattr */
|
||||||
(setattrfunc)0, /* tp_setattr */
|
(setattrfunc)0, /* tp_setattr */
|
||||||
(cmpfunc)0, /* tp_compare */
|
(cmpfunc)0, /* tp_compare */
|
||||||
|
|
|
@ -67,14 +67,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
|
static int
|
||||||
rpmps_length(rpmpsObject * s)
|
rpmps_length(rpmpsObject * s)
|
||||||
{
|
{
|
||||||
|
@ -141,7 +133,7 @@ PyTypeObject rpmps_Type = {
|
||||||
0, /* tp_itemsize */
|
0, /* tp_itemsize */
|
||||||
/* methods */
|
/* methods */
|
||||||
(destructor) rpmps_dealloc, /* tp_dealloc */
|
(destructor) rpmps_dealloc, /* tp_dealloc */
|
||||||
(printfunc) rpmps_print, /* tp_print */
|
0, /* tp_print */
|
||||||
(getattrfunc)0, /* tp_getattr */
|
(getattrfunc)0, /* tp_getattr */
|
||||||
(setattrfunc)0, /* tp_setattr */
|
(setattrfunc)0, /* tp_setattr */
|
||||||
(cmpfunc)0, /* tp_compare */
|
(cmpfunc)0, /* tp_compare */
|
||||||
|
|
|
@ -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[] =
|
static char rpmte_doc[] =
|
||||||
"";
|
"";
|
||||||
|
|
||||||
|
@ -286,7 +271,7 @@ PyTypeObject rpmte_Type = {
|
||||||
sizeof(rpmteObject), /* tp_size */
|
sizeof(rpmteObject), /* tp_size */
|
||||||
0, /* tp_itemsize */
|
0, /* tp_itemsize */
|
||||||
(destructor)0, /* tp_dealloc */
|
(destructor)0, /* tp_dealloc */
|
||||||
(printfunc) rpmte_print, /* tp_print */
|
0, /* tp_print */
|
||||||
(getattrfunc)0, /* tp_getattr */
|
(getattrfunc)0, /* tp_getattr */
|
||||||
(setattrfunc)0, /* tp_setattr */
|
(setattrfunc)0, /* tp_setattr */
|
||||||
0, /* tp_compare */
|
0, /* tp_compare */
|
||||||
|
|
Loading…
Reference in New Issue