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

@ -172,15 +172,13 @@ static struct getsetlist meth_getsets [] = {
static PyObject *
meth_repr(PyCFunctionObject *m)
{
char buf[200];
if (m->m_self == NULL)
sprintf(buf, "<built-in function %.80s>", m->m_ml->ml_name);
else
sprintf(buf,
"<built-in method %.80s of %.80s object at %p>",
m->m_ml->ml_name, m->m_self->ob_type->tp_name,
m->m_self);
return PyString_FromString(buf);
return PyString_FromFormat("<built-in function %s>",
m->m_ml->ml_name);
return PyString_FromFormat("<built-in method %s of %s object at %p>",
m->m_ml->ml_name,
m->m_self->ob_type->tp_name,
m->m_self);
}
static int