mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
repr's converted to using PyString_FromFormat() instead of sprintf'ing
into a hardcoded char* buffer. Closes patch #454743.
This commit is contained in:
parent
dadace004b
commit
7ce3694a52
11 changed files with 95 additions and 136 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue