[issue14161] python2 file __repr__ does not escape filename

Éric Araujo report at bugs.python.org
Thu Mar 1 06:47:13 CET 2012


Éric Araujo <merwok at netwok.org> added the comment:

Funny one :D  Reproduced on linux:

  >>> open('/tmp/t\nest', 'w')
  <open file '/tmp/t
  est', mode 'w' at 0x7f11268a19c0>

file_repr in Objects/fileobject.c calls http://docs.python.org/c-api/unicode#PyUnicode_AsUnicodeEscapeString, equivalent to encode('unicode-escape'), so backslashes should be escaped.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14161>
_______________________________________


More information about the Python-bugs-list mailing list