repr's converted to using PyString_FromFormat() instead of sprintf'ing
into a hardcoded char* buffer.
Closes patch #454743.
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 @@
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