summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorFlorent Xicluna <florent.xicluna@gmail.com>2010-03-11 15:55:11 (GMT)
committerFlorent Xicluna <florent.xicluna@gmail.com>2010-03-11 15:55:11 (GMT)
commite2e81e8fcd41413d31a1a4a078128c478bc73b9a (patch)
tree93c0141f4fc4c158adf0448fea9bbab5aaceff2d /Modules
parent3e8c189faae661d44c61839986614fce595fc404 (diff)
downloadcpython-e2e81e8fcd41413d31a1a4a078128c478bc73b9a.zip
cpython-e2e81e8fcd41413d31a1a4a078128c478bc73b9a.tar.gz
cpython-e2e81e8fcd41413d31a1a4a078128c478bc73b9a.tar.bz2
Fix repr of tree Element on windows.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_elementtree.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c
index 62aee85..0aa1ebb 100644
--- a/Modules/_elementtree.c
+++ b/Modules/_elementtree.c
@@ -1190,15 +1190,16 @@ element_remove(ElementObject* self, PyObject* args)
static PyObject*
element_repr(ElementObject* self)
{
- PyObject* repr;
- char buffer[100];
-
- repr = PyString_FromString("<Element ");
+ PyObject *repr, *tag;
- PyString_ConcatAndDel(&repr, PyObject_Repr(self->tag));
+ tag = PyObject_Repr(self->tag);
+ if (!tag)
+ return NULL;
- sprintf(buffer, " at %p>", self);
- PyString_ConcatAndDel(&repr, PyString_FromString(buffer));
+ repr = PyString_FromFormat("<Element %s at %p>",
+ PyString_AS_STRING(tag), self);
+
+ Py_DECREF(tag);
return repr;
}