diff options
author | Barry Warsaw <barry@python.org> | 2001-08-24 18:34:26 (GMT) |
---|---|---|
committer | Barry Warsaw <barry@python.org> | 2001-08-24 18:34:26 (GMT) |
commit | 7ce3694a527afe425a2b9df65c049b0ef4e75960 (patch) | |
tree | 089937f432c69e85afbfc8308d5ebc86dd2c2c49 /Objects/fileobject.c | |
parent | dadace004b4b94dcc4437bafc9c8407fbb1bed74 (diff) | |
download | cpython-7ce3694a527afe425a2b9df65c049b0ef4e75960.zip cpython-7ce3694a527afe425a2b9df65c049b0ef4e75960.tar.gz cpython-7ce3694a527afe425a2b9df65c049b0ef4e75960.tar.bz2 |
repr's converted to using PyString_FromFormat() instead of sprintf'ing
into a hardcoded char* buffer.
Closes patch #454743.
Diffstat (limited to 'Objects/fileobject.c')
-rw-r--r-- | Objects/fileobject.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/Objects/fileobject.c b/Objects/fileobject.c index 0bb2f25..e18e2a2 100644 --- a/Objects/fileobject.c +++ b/Objects/fileobject.c @@ -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 * |