Use generic python get/set attribute functions directly where appropriate

- no point in wrapping all this stuff in our own functions
This commit is contained in:
Panu Matilainen 2009-09-22 17:27:44 +03:00
parent 711ab9bab1
commit ca6591e86c
6 changed files with 12 additions and 76 deletions

View File

@ -207,16 +207,6 @@ static void rpmdb_dealloc(rpmdbObject * s)
PyObject_Del(s);
}
static PyObject * rpmdb_getattro(PyObject * o, PyObject * n)
{
return PyObject_GenericGetAttr(o, n);
}
static int rpmdb_setattro(PyObject * o, PyObject * n, PyObject * v)
{
return PyObject_GenericSetAttr(o, n, v);
}
/**
*/
static char rpmdb_doc[] =
@ -242,8 +232,8 @@ PyTypeObject rpmdb_Type = {
0, /* tp_hash */
0, /* tp_call */
0, /* tp_str */
(getattrofunc) rpmdb_getattro, /* tp_getattro */
(setattrofunc) rpmdb_setattro, /* tp_setattro */
PyObject_GenericGetAttr, /* tp_getattro */
PyObject_GenericSetAttr, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT, /* tp_flags */
rpmdb_doc, /* tp_doc */

View File

@ -449,16 +449,6 @@ rpmds_print(rpmdsObject * s, FILE * fp, int flags)
return 0;
}
static PyObject * rpmds_getattro(PyObject * o, PyObject * n)
{
return PyObject_GenericGetAttr(o, n);
}
static int rpmds_setattro(PyObject * o, PyObject * n, PyObject * v)
{
return PyObject_GenericSetAttr(o, n, v);
}
static int
rpmds_length(rpmdsObject * s)
{
@ -580,8 +570,8 @@ PyTypeObject rpmds_Type = {
(hashfunc)0, /* tp_hash */
(ternaryfunc)0, /* tp_call */
(reprfunc)0, /* tp_str */
(getattrofunc) rpmds_getattro, /* tp_getattro */
(setattrofunc) rpmds_setattro, /* tp_setattro */
PyObject_GenericGetAttr, /* tp_getattro */
PyObject_GenericSetAttr, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT | /* tp_flags */
Py_TPFLAGS_HAVE_RICHCOMPARE,

View File

@ -340,16 +340,6 @@ rpmfi_print(rpmfiObject * s, FILE * fp, int flags)
return 0;
}
static PyObject * rpmfi_getattro(PyObject * o, PyObject * n)
{
return PyObject_GenericGetAttr(o, n);
}
static int rpmfi_setattro(PyObject * o, PyObject * n, PyObject * v)
{
return PyObject_GenericSetAttr(o, n, v);
}
static int
rpmfi_length(rpmfiObject * s)
{
@ -472,8 +462,8 @@ PyTypeObject rpmfi_Type = {
(hashfunc)0, /* tp_hash */
(ternaryfunc)0, /* tp_call */
(reprfunc)0, /* tp_str */
(getattrofunc) rpmfi_getattro, /* tp_getattro */
(setattrofunc) rpmfi_setattro, /* tp_setattro */
PyObject_GenericGetAttr, /* tp_getattro */
PyObject_GenericSetAttr, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT, /* tp_flags */
rpmfi_doc, /* tp_doc */

View File

@ -192,16 +192,6 @@ static void rpmmi_dealloc(rpmmiObject * s)
}
}
static PyObject * rpmmi_getattro(PyObject * o, PyObject * n)
{
return PyObject_GenericGetAttr(o, n);
}
static int rpmmi_setattro(PyObject * o, PyObject * n, PyObject * v)
{
return PyObject_GenericSetAttr(o, n, v);
}
/**
*/
static char rpmmi_doc[] =
@ -227,8 +217,8 @@ PyTypeObject rpmmi_Type = {
0, /* tp_hash */
0, /* tp_call */
0, /* tp_str */
(getattrofunc) rpmmi_getattro, /* tp_getattro */
(setattrofunc) rpmmi_setattro, /* tp_setattro */
PyObject_GenericGetAttr, /* tp_getattro */
PyObject_GenericSetAttr, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT, /* tp_flags */
rpmmi_doc, /* tp_doc */

View File

@ -114,20 +114,6 @@ fprintf(stderr, "*** rpmps_print(%p,%p,%x)\n", s, (void *)fp, flags);
return 0;
}
static PyObject * rpmps_getattro(PyObject * o, PyObject * n)
{
if (_rpmps_debug < 0)
fprintf(stderr, "*** rpmps_getattro(%p,%p)\n", o, n);
return PyObject_GenericGetAttr(o, n);
}
static int rpmps_setattro(PyObject * o, PyObject * n, PyObject * v)
{
if (_rpmps_debug < 0)
fprintf(stderr, "*** rpmps_setattro(%p,%p,%p)\n", o, n, v);
return PyObject_GenericSetAttr(o, n, v);
}
static int
rpmps_length(rpmpsObject * s)
{
@ -257,8 +243,8 @@ PyTypeObject rpmps_Type = {
(hashfunc)0, /* tp_hash */
(ternaryfunc)0, /* tp_call */
(reprfunc)0, /* tp_str */
(getattrofunc) rpmps_getattro, /* tp_getattro */
(setattrofunc) rpmps_setattro, /* tp_setattro */
PyObject_GenericGetAttr, /* tp_getattro */
PyObject_GenericSetAttr, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT, /* tp_flags */
rpmps_doc, /* tp_doc */

View File

@ -301,16 +301,6 @@ rpmte_print(rpmteObject * s, FILE * fp, int flags)
return 0;
}
static PyObject * rpmte_getattro(PyObject * o, PyObject * n)
{
return PyObject_GenericGetAttr(o, n);
}
static int rpmte_setattro(PyObject * o, PyObject * n, PyObject * v)
{
return PyObject_GenericSetAttr(o, n, v);
}
/**
*/
static char rpmte_doc[] =
@ -336,8 +326,8 @@ PyTypeObject rpmte_Type = {
0, /* tp_hash */
0, /* tp_call */
0, /* tp_str */
(getattrofunc) rpmte_getattro, /* tp_getattro */
(setattrofunc) rpmte_setattro, /* tp_setattro */
PyObject_GenericGetAttr, /* tp_getattro */
PyObject_GenericSetAttr, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT, /* tp_flags */
rpmte_doc, /* tp_doc */