Kristján Valur Jónsson <krist...@ccpgames.com> added the comment:

I thought I'd explained it in detail without having to invoke the 
testsuite.  If TEMPFN is "tm...@test" you get the following failure:
FAILED (failures=1)
test test_file failed -- Traceback (most recent call last):
  File "D:\pydev\python\trunk\lib\test\test_file.py", line 175, in 
testUnicodeOpen
    self.assert_(repr(f).startswith("<open file u'" + TESTFN))
AssertionError: None

It fails, because print repr(f) will start with:
<open file u'tm...@test


Essentially, when generating a repr of a fileobject with a string 
filename, the string filename is interpolated between the single colons.
But when it generates a repr of a fileobject with a unicode filename, 
the unicode name is  escaped and then interpolated.
This results in unicode filename fileobjects having a repr with escaped 
backslashes, while the string filename fileobjects have a repr where the 
backslashes appear unescaped between the colons.

My patch proposes to 
a) make sure that the repr(f) is a string containing the repr of the 
filename (be it unicode, string or whatever)
b) Fix the testsuite so that both this case and the one testing string 
filenames assumes a repr of the filename.

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue4927>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to