summaryrefslogtreecommitdiffstats
path: root/Objects/object.c
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2001-08-24 18:34:26 (GMT)
committerBarry Warsaw <barry@python.org>2001-08-24 18:34:26 (GMT)
commit7ce3694a527afe425a2b9df65c049b0ef4e75960 (patch)
tree089937f432c69e85afbfc8308d5ebc86dd2c2c49 /Objects/object.c
parentdadace004b4b94dcc4437bafc9c8407fbb1bed74 (diff)
downloadcpython-7ce3694a527afe425a2b9df65c049b0ef4e75960.zip
cpython-7ce3694a527afe425a2b9df65c049b0ef4e75960.tar.gz
cpython-7ce3694a527afe425a2b9df65c049b0ef4e75960.tar.bz2
repr's converted to using PyString_FromFormat() instead of sprintf'ing
into a hardcoded char* buffer. Closes patch #454743.
Diffstat (limited to 'Objects/object.c')
-rw-r--r--Objects/object.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/Objects/object.c b/Objects/object.c
index 7e4a211..1d62690 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -222,6 +222,7 @@ void _PyGC_Dump(PyGC_Head* op)
}
#endif /* WITH_CYCLE_GC */
+
PyObject *
PyObject_Repr(PyObject *v)
{
@@ -235,12 +236,9 @@ PyObject_Repr(PyObject *v)
#endif
if (v == NULL)
return PyString_FromString("<NULL>");
- else if (v->ob_type->tp_repr == NULL) {
- char buf[120];
- sprintf(buf, "<%.80s object at %p>",
- v->ob_type->tp_name, v);
- return PyString_FromString(buf);
- }
+ else if (v->ob_type->tp_repr == NULL)
+ return PyString_FromFormat("<%s object at %p",
+ v->ob_type->tp_name, v);
else {
PyObject *res;
res = (*v->ob_type->tp_repr)(v);