]> granicus.if.org Git - python/commitdiff
Simplify ste_repr().
authorWalter Dörwald <walter@livinglogic.de>
Mon, 11 Jun 2007 16:03:16 +0000 (16:03 +0000)
committerWalter Dörwald <walter@livinglogic.de>
Mon, 11 Jun 2007 16:03:16 +0000 (16:03 +0000)
Python/symtable.c

index 5df7318d17072184ab976722f381fc0326b19935..0f7642a2c583dc65fdc6b8ceaa42be595e98fbdc 100644 (file)
@@ -88,13 +88,9 @@ PySTEntry_New(struct symtable *st, identifier name, _Py_block_ty block,
 static PyObject *
 ste_repr(PySTEntryObject *ste)
 {
-       char buf[256];
-
-       PyOS_snprintf(buf, sizeof(buf),
-                     "<symtable entry %.100s(%ld), line %d>",
-                     PyUnicode_AsString(ste->ste_name),
-                     PyInt_AS_LONG(ste->ste_id), ste->ste_lineno);
-       return PyUnicode_FromString(buf);
+       return PyUnicode_FromFormat("<symtable entry %U(%ld), line %d>",
+                                   ste->ste_name,
+                                   PyInt_AS_LONG(ste->ste_id), ste->ste_lineno);
 }
 
 static void