[Python-3000-checkins] r55787 - python/branches/py3k-struni/Objects/codeobject.c
walter.doerwald
python-3000-checkins at python.org
Wed Jun 6 17:15:35 CEST 2007
Author: walter.doerwald
Date: Wed Jun 6 17:15:34 2007
New Revision: 55787
Modified:
python/branches/py3k-struni/Objects/codeobject.c
Log:
Use PyUnicode_FromFormat() directly.
Modified: python/branches/py3k-struni/Objects/codeobject.c
==============================================================================
--- python/branches/py3k-struni/Objects/codeobject.c (original)
+++ python/branches/py3k-struni/Objects/codeobject.c Wed Jun 6 17:15:34 2007
@@ -286,7 +286,6 @@
static PyObject *
code_repr(PyCodeObject *co)
{
- char buf[500];
int lineno = -1;
char *filename = "???";
char *name = "???";
@@ -297,10 +296,9 @@
filename = PyString_AS_STRING(co->co_filename);
if (co->co_name && PyString_Check(co->co_name))
name = PyString_AS_STRING(co->co_name);
- PyOS_snprintf(buf, sizeof(buf),
- "<code object %.100s at %p, file \"%.300s\", line %d>",
- name, co, filename, lineno);
- return PyUnicode_FromString(buf);
+ return PyUnicode_FromFormat(
+ "<code object %.100s at %p, file \"%.300s\", line %d>",
+ name, co, filename, lineno);
}
static PyObject *
More information about the Python-3000-checkins
mailing list