mirror of
https://github.com/python/cpython.git
synced 2025-11-26 21:33:10 +00:00
parent
4b0a315c31
commit
fc28e0de58
1 changed files with 3 additions and 3 deletions
|
|
@ -411,11 +411,11 @@ file_repr(PyFileObject *f)
|
||||||
if (PyUnicode_Check(f->f_name)) {
|
if (PyUnicode_Check(f->f_name)) {
|
||||||
#ifdef Py_USING_UNICODE
|
#ifdef Py_USING_UNICODE
|
||||||
PyObject *ret = NULL;
|
PyObject *ret = NULL;
|
||||||
PyObject *name;
|
PyObject *name = PyUnicode_AsUnicodeEscapeString(f->f_name);
|
||||||
name = PyUnicode_AsUnicodeEscapeString(f->f_name);
|
const char *name_str = name ? PyString_AsString(name) : "?";
|
||||||
ret = PyString_FromFormat("<%s file u'%s', mode '%s' at %p>",
|
ret = PyString_FromFormat("<%s file u'%s', mode '%s' at %p>",
|
||||||
f->f_fp == NULL ? "closed" : "open",
|
f->f_fp == NULL ? "closed" : "open",
|
||||||
PyString_AsString(name),
|
name_str,
|
||||||
PyString_AsString(f->f_mode),
|
PyString_AsString(f->f_mode),
|
||||||
f);
|
f);
|
||||||
Py_XDECREF(name);
|
Py_XDECREF(name);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue