summaryrefslogtreecommitdiffstats
path: root/Objects/funcobject.c
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2001-08-24 18:34:26 (GMT)
committerBarry Warsaw <barry@python.org>2001-08-24 18:34:26 (GMT)
commit7ce3694a527afe425a2b9df65c049b0ef4e75960 (patch)
tree089937f432c69e85afbfc8308d5ebc86dd2c2c49 /Objects/funcobject.c
parentdadace004b4b94dcc4437bafc9c8407fbb1bed74 (diff)
downloadcpython-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/funcobject.c')
-rw-r--r--Objects/funcobject.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/Objects/funcobject.c b/Objects/funcobject.c
index 6532e58..6f56bf6 100644
--- a/Objects/funcobject.c
+++ b/Objects/funcobject.c
@@ -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