mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
Use PyUnicode_FromFormat() directly.
This commit is contained in:
parent
2a0c081470
commit
933daed922
1 changed files with 3 additions and 5 deletions
|
@ -286,7 +286,6 @@ code_dealloc(PyCodeObject *co)
|
||||||
static PyObject *
|
static PyObject *
|
||||||
code_repr(PyCodeObject *co)
|
code_repr(PyCodeObject *co)
|
||||||
{
|
{
|
||||||
char buf[500];
|
|
||||||
int lineno = -1;
|
int lineno = -1;
|
||||||
char *filename = "???";
|
char *filename = "???";
|
||||||
char *name = "???";
|
char *name = "???";
|
||||||
|
@ -297,10 +296,9 @@ code_repr(PyCodeObject *co)
|
||||||
filename = PyString_AS_STRING(co->co_filename);
|
filename = PyString_AS_STRING(co->co_filename);
|
||||||
if (co->co_name && PyString_Check(co->co_name))
|
if (co->co_name && PyString_Check(co->co_name))
|
||||||
name = PyString_AS_STRING(co->co_name);
|
name = PyString_AS_STRING(co->co_name);
|
||||||
PyOS_snprintf(buf, sizeof(buf),
|
return PyUnicode_FromFormat(
|
||||||
"<code object %.100s at %p, file \"%.300s\", line %d>",
|
"<code object %.100s at %p, file \"%.300s\", line %d>",
|
||||||
name, co, filename, lineno);
|
name, co, filename, lineno);
|
||||||
return PyUnicode_FromString(buf);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue