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
|
@ -179,13 +179,11 @@ file_dealloc(PyFileObject *f)
|
|||
static PyObject *
|
||||
file_repr(PyFileObject *f)
|
||||
{
|
||||
char buf[300];
|
||||
sprintf(buf, "<%s file '%.256s', mode '%.10s' at %p>",
|
||||
f->f_fp == NULL ? "closed" : "open",
|
||||
PyString_AsString(f->f_name),
|
||||
PyString_AsString(f->f_mode),
|
||||
f);
|
||||
return PyString_FromString(buf);
|
||||
return PyString_FromFormat("<%s file '%s', mode '%s' at %p>",
|
||||
f->f_fp == NULL ? "closed" : "open",
|
||||
PyString_AsString(f->f_name),
|
||||
PyString_AsString(f->f_mode),
|
||||
f);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue