Mercurial > cpython-lru_cache-weakref
diff Objects/methodobject.c @ 19476:0e70df98424e legacy-trunk
repr's converted to using PyString_FromFormat() instead of sprintf'ing
into a hardcoded char* buffer.
Closes patch #454743.
| author | Barry Warsaw <barry@python.org> |
|---|---|
| date | Fri, 24 Aug 2001 18:34:26 +0000 |
| parents | b9701538f827 |
| children | 00de719ae831 |
line wrap: on
line diff
--- a/Objects/methodobject.c Fri Aug 24 18:32:06 2001 +0000 +++ b/Objects/methodobject.c Fri Aug 24 18:34:26 2001 +0000 @@ -172,15 +172,13 @@ 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
