repr's converted to using PyString_FromFormat() instead of sprintf'ing

into a hardcoded char* buffer.

Closes patch #454743.
This commit is contained in:
Barry Warsaw 2001-08-24 18:34:26 +00:00
parent dadace004b
commit 7ce3694a52
11 changed files with 95 additions and 136 deletions

View file

@ -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);