summaryrefslogtreecommitdiffstats
path: root/Objects/fileobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/fileobject.c')
-rw-r--r--Objects/fileobject.c12
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 *