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

@ -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 *