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/cellobject.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/cellobject.c')
-rw-r--r-- | Objects/cellobject.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/Objects/cellobject.c b/Objects/cellobject.c index 9a36776..47e5174 100644 --- a/Objects/cellobject.c +++ b/Objects/cellobject.c @@ -62,14 +62,12 @@ cell_compare(PyCellObject *a, PyCellObject *b) static PyObject * cell_repr(PyCellObject *op) { - char buf[256]; - if (op->ob_ref == NULL) - sprintf(buf, "<cell at %p: empty>", op); - else - sprintf(buf, "<cell at %p: %.80s object at %p>", - op, op->ob_ref->ob_type->tp_name, op->ob_ref); - return PyString_FromString(buf); + return PyString_FromFormat("<cell at %p: empty>", op); + + return PyString_FromFormat("<cell at %p: %.80s object at %p>", + op, op->ob_ref->ob_type->tp_name, + op->ob_ref); } static int |