mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +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
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue