[issue4927] Inconsistent unicode repr for fileobject

2009-01-16 Thread Martin v. Löwis
Martin v. Löwis added the comment: > It is therefore quite unlikely to cause any > problems. That is a false conclusion. The test suite cannot speak for all the code out there that might break with the incompatible change that you are proposing. ___ Python

[issue4927] Inconsistent unicode repr for fileobject

2009-01-16 Thread Martin v. Löwis
Martin v. Löwis added the comment: > So you are saying that you see no problem with the repr of a fileobject > being generated in different ways depending on the fileobject being > unicode or string? My question is: What is the issue at hand? Is it what the subject says (inconsistent represen

[issue4927] Inconsistent unicode repr for fileobject

2009-01-16 Thread Guido van Rossum
Guido van Rossum added the comment: I think this is my fault. I should have used the proper repr() of the filename in the repr() of a file object from the beginning, then this wouldn't have been a problem. I think we should let this rest for Python 2.x (except for fixing the test suite). Fort

[issue4927] Inconsistent unicode repr for fileobject

2009-01-16 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: That's true, but a it's a different point entirely You see, this is not a problem with backslashes only: If you have any kind of control caracter or high bit character in your filename, you may be in for trouble, because interpolating that string verba

[issue4927] Inconsistent unicode repr for fileobject

2009-01-16 Thread Terry J. Reedy
Terry J. Reedy added the comment: I think path names should be printed with forward slashes on Windows as well as elsewhere to avoid this type of confusion, and this. >>> sb 'tmp\\foo' >>> print(sb) tmp\foo (Of course I know why.) Users have been advised on python-list by various people to ente

[issue4927] Inconsistent unicode repr for fileobject

2009-01-16 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: And btw, This can be fixed in fileobject.c without affecting the testsuite at all, since test_file.py has never tested filenames with backslashes except by accident. It is therefore quite unlikely to cause any problems. _

[issue4927] Inconsistent unicode repr for fileobject

2009-01-16 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: So you are saying that you see no problem with the repr of a fileobject being generated in different ways depending on the fileobject being unicode or string? You see no danger of confusion when one is confonted with vs. You don't think anyone will b

[issue4927] Inconsistent unicode repr for fileobject

2009-01-15 Thread Martin v. Löwis
Martin v. Löwis added the comment: > I think the testsuite just exposed a design fault in python or a bug, if > you will. I disagree. The feature is intentional as-is, and well-designed. > It is customary when producing a > repr() of an object, to have it contain a repr() of the any inner >

[issue4927] Inconsistent unicode repr for fileobject

2009-01-15 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: I think the testsuite just exposed a design fault in python or a bug, if you will. When we by accident had a backslash in the filename, I noticed the inconsistency between 't...@test' and u'tm...@test'. One is a valid repr, the other isn't. It is cus

[issue4927] Inconsistent unicode repr for fileobject

2009-01-15 Thread Martin v. Löwis
Martin v. Löwis added the comment: > I thought I'd explained it in detail [...] Well, so far, you didn't say that it was testUnicodeOpen that failed. Now that I see that, I can understand the problem. In your original message, I failed to see a problem. Yes, the repr is inconsistent - but why

[issue4927] Inconsistent unicode repr for fileobject

2009-01-15 Thread Kristján Valur Jónsson
Kristján Valur Jónsson 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

[issue4927] Inconsistent unicode repr for fileobject

2009-01-15 Thread Martin v. Löwis
Martin v. Löwis added the comment: > Any thoughts? I still hadn't time to reproduce the problem, so I still don't understand it. What specific failure (file and line number) occurs, and what specific strings get compared? test_file.py has 600 lines, and I can't guess which test is failing. (als

[issue4927] Inconsistent unicode repr for fileobject

2009-01-15 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Just to clarify, Ascii files and unicode files will repr() as respectively. In the former, the backslash isn't escaped, but in the latter it is. The single quotes certainly imply repr, and if this were a list, it would repr as: ['tmp\\foo'] and so

[issue4927] Inconsistent unicode repr for fileobject

2009-01-13 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Turns out it wasn't vista related at all, but related to TESTFN being t...@test When this happens, test_file.py fails when testing the repr for a unicode file, because the repr contains u'tm...@test' whereas for a string filename it will contain 't...

[issue4927] Inconsistent unicode repr for fileobject

2009-01-13 Thread Martin v. Löwis
Martin v. Löwis added the comment: > This leads to problems in the testsuite on vista. To which problem specifically? -- nosy: +loewis ___ Python tracker ___ ___

[issue4927] Inconsistent unicode repr for fileobject

2009-01-13 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Adding patch for test_file Added file: http://bugs.python.org/file12714/test_file.patch ___ Python tracker ___ _

[issue4927] Inconsistent unicode repr for fileobject

2009-01-13 Thread Kristján Valur Jónsson
New submission from Kristján Valur Jónsson : The repr for fileobjects is inconsistent. On windows: f = file("tmp\\foo", "wb") f f = file(u"tmp\\foo", "wb") f For unicode, the filename is a proper "repr", but for a string it is just the plain string, enclosed in single quotes. Note that I co