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/funcobject.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/funcobject.c')
-rw-r--r-- | Objects/funcobject.c | 11 |
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 |