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

@ -239,14 +239,11 @@ func_dealloc(PyFunctionObject *op)
static PyObject*
func_repr(PyFunctionObject *op)
{
char buf[140];
if (op->func_name == Py_None)
sprintf(buf, "<anonymous function at %p>", op);
else
sprintf(buf, "<function %.100s at %p>",
PyString_AsString(op->func_name),
op);
return PyString_FromString(buf);
return PyString_FromFormat("<anonymous function at %p>", op);
return PyString_FromFormat("<function %s at %p>",
PyString_AsString(op->func_name),
op);
}
static int