Dropped almost-no-op customized objects repr()

The default repr is enough: it prints <TypeName at 0xADDR> instead of
<TypeName object at 0xADDR>.

The only people being hurt by this change are the ones using doctests:
they deserve it.
This commit is contained in:
Daniele Varrazzo 2014-08-15 02:06:27 +01:00
parent 669e787919
commit 95165cef7d
10 changed files with 10 additions and 72 deletions

View File

@ -149,12 +149,6 @@ asis_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
return type->tp_alloc(type, 0);
}
static PyObject *
asis_repr(asisObject *self)
{
return PyString_FromFormat("<psycopg2.extensions.AsIs object at %p>", self);
}
/* object type */
@ -170,7 +164,7 @@ PyTypeObject asisType = {
0, /*tp_getattr*/
0, /*tp_setattr*/
0, /*tp_compare*/
(reprfunc)asis_repr, /*tp_repr*/
0, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/

View File

@ -254,11 +254,6 @@ binary_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
return type->tp_alloc(type, 0);
}
static PyObject *
binary_repr(binaryObject *self)
{
return PyString_FromFormat("<psycopg2.extensions.Binary object at %p>", self);
}
/* object type */
@ -274,7 +269,7 @@ PyTypeObject binaryType = {
0, /*tp_getattr*/
0, /*tp_setattr*/
0, /*tp_compare*/
(reprfunc)binary_repr, /*tp_repr*/
0, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/

View File

@ -214,12 +214,6 @@ pydatetime_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
return type->tp_alloc(type, 0);
}
static PyObject *
pydatetime_repr(pydatetimeObject *self)
{
return PyString_FromFormat("<psycopg2._psycopg.datetime object at %p>",
self);
}
/* object type */
@ -235,7 +229,7 @@ PyTypeObject pydatetimeType = {
0, /*tp_getattr*/
0, /*tp_setattr*/
0, /*tp_compare*/
(reprfunc)pydatetime_repr, /*tp_repr*/
0, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/

View File

@ -215,11 +215,6 @@ list_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
return type->tp_alloc(type, 0);
}
static PyObject *
list_repr(listObject *self)
{
return PyString_FromFormat("<psycopg2._psycopg.List object at %p>", self);
}
/* object type */
@ -235,7 +230,7 @@ PyTypeObject listType = {
0, /*tp_getattr*/
0, /*tp_setattr*/
0, /*tp_compare*/
(reprfunc)list_repr, /*tp_repr*/
0, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/

View File

@ -205,12 +205,6 @@ mxdatetime_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
return type->tp_alloc(type, 0);
}
static PyObject *
mxdatetime_repr(mxdatetimeObject *self)
{
return PyString_FromFormat("<psycopg2._psycopg.MxDateTime object at %p>",
self);
}
/* object type */
@ -226,7 +220,7 @@ PyTypeObject mxdatetimeType = {
0, /*tp_getattr*/
0, /*tp_setattr*/
0, /*tp_compare*/
(reprfunc)mxdatetime_repr, /*tp_repr*/
0, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/

View File

@ -146,13 +146,6 @@ pboolean_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
return type->tp_alloc(type, 0);
}
static PyObject *
pboolean_repr(pbooleanObject *self)
{
return PyString_FromFormat("<psycopg2.extensions.Boolean object at %p>",
self);
}
/* object type */
@ -168,7 +161,7 @@ PyTypeObject pbooleanType = {
0, /*tp_getattr*/
0, /*tp_setattr*/
0, /*tp_compare*/
(reprfunc)pboolean_repr, /*tp_repr*/
0, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/

View File

@ -202,13 +202,6 @@ pdecimal_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
return type->tp_alloc(type, 0);
}
static PyObject *
pdecimal_repr(pdecimalObject *self)
{
return PyString_FromFormat("<psycopg2._psycopg.Decimal object at %p>",
self);
}
/* object type */
@ -224,7 +217,7 @@ PyTypeObject pdecimalType = {
0, /*tp_getattr*/
0, /*tp_setattr*/
0, /*tp_compare*/
(reprfunc)pdecimal_repr, /*tp_repr*/
0, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/

View File

@ -175,13 +175,6 @@ pfloat_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
return type->tp_alloc(type, 0);
}
static PyObject *
pfloat_repr(pfloatObject *self)
{
return PyString_FromFormat("<psycopg2.extensions.Float object at %p>",
self);
}
/* object type */
@ -197,7 +190,7 @@ PyTypeObject pfloatType = {
0, /*tp_getattr*/
0, /*tp_setattr*/
0, /*tp_compare*/
(reprfunc)pfloat_repr, /*tp_repr*/
0, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/

View File

@ -161,13 +161,6 @@ pint_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
return type->tp_alloc(type, 0);
}
static PyObject *
pint_repr(pintObject *self)
{
return PyString_FromFormat("<psycopg2.extensions.Int object at %p>",
self);
}
/* object type */
@ -183,7 +176,7 @@ PyTypeObject pintType = {
0, /*tp_getattr*/
0, /*tp_setattr*/
0, /*tp_compare*/
(reprfunc)pint_repr, /*tp_repr*/
0, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/

View File

@ -242,12 +242,6 @@ qstring_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
return type->tp_alloc(type, 0);
}
static PyObject *
qstring_repr(qstringObject *self)
{
return PyString_FromFormat(
"<psycopg2.extensions.QuotedString object at %p>", self);
}
/* object type */
@ -263,7 +257,7 @@ PyTypeObject qstringType = {
0, /*tp_getattr*/
0, /*tp_setattr*/
0, /*tp_compare*/
(reprfunc)qstring_repr, /*tp_repr*/
0, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/