diff options
author | Ezio Melotti <ezio.melotti@gmail.com> | 2010-12-18 15:06:45 (GMT) |
---|---|---|
committer | Ezio Melotti <ezio.melotti@gmail.com> | 2010-12-18 15:06:45 (GMT) |
commit | 9d254f70928644cb573b0321c912eaabd012bfc4 (patch) | |
tree | 80cdf1c39c62b8b288a450e030ddccaa9b3a6b0c /Objects/descrobject.c | |
parent | c79cf042505d10f134b741f6836e4abfacbcd24f (diff) | |
download | cpython-9d254f70928644cb573b0321c912eaabd012bfc4.zip cpython-9d254f70928644cb573b0321c912eaabd012bfc4.tar.gz cpython-9d254f70928644cb573b0321c912eaabd012bfc4.tar.bz2 |
Merged revisions 87368 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r87368 | ezio.melotti | 2010-12-18 15:59:43 +0100 (Sat, 18 Dec 2010) | 1 line
#5587: add a repr to dict_proxy objects. Patch by David Stanek and Daniel Urban.
........
Diffstat (limited to 'Objects/descrobject.c')
-rw-r--r-- | Objects/descrobject.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Objects/descrobject.c b/Objects/descrobject.c index 5e59271..5f118ce 100644 --- a/Objects/descrobject.c +++ b/Objects/descrobject.c @@ -766,6 +766,12 @@ proxy_str(proxyobject *pp) return PyObject_Str(pp->dict); } +static PyObject * +proxy_repr(proxyobject *pp) +{ + return PyUnicode_FromFormat("dict_proxy(%R)", pp->dict); +} + static int proxy_traverse(PyObject *self, visitproc visit, void *arg) { @@ -791,7 +797,7 @@ PyTypeObject PyDictProxy_Type = { 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_reserved */ - 0, /* tp_repr */ + (reprfunc)proxy_repr, /* tp_repr */ 0, /* tp_as_number */ &proxy_as_sequence, /* tp_as_sequence */ &proxy_as_mapping, /* tp_as_mapping */ |