This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author kristjan.jonsson
Recipients kristjan.jonsson, loewis
Date 2009-01-15.22:30:38
SpamBayes Score 0.009671302
Marked as misclassified No
Message-id <1232058701.65.0.971545626481.issue4927@psf.upfronthosting.co.za>
In-reply-to
Content
I thought I'd explained it in detail without having to invoke the 
testsuite.  If TEMPFN is "tmp\\@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'tmp\\@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.
History
Date User Action Args
2009-01-15 22:31:41kristjan.jonssonsetrecipients: + kristjan.jonsson, loewis
2009-01-15 22:31:41kristjan.jonssonsetmessageid: <1232058701.65.0.971545626481.issue4927@psf.upfronthosting.co.za>
2009-01-15 22:30:40kristjan.jonssonlinkissue4927 messages
2009-01-15 22:30:39kristjan.jonssoncreate