[issue4927] Inconsistent unicode repr for fileobject

Kristján Valur Jónsson report at bugs.python.org
Thu Jan 15 23:55:17 CET 2009


Kristján Valur Jónsson <kristjan at ccpgames.com> 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
'tmp\@test' and u'tmp\\@test'.
One is a valid repr, the other isn't.  It is customary when producing a 
repr() of an object, to have it contain a repr() of the any inner 
object, such as a string.  'tmp\@test' looks like a valid python literal 
but if entered, would produce an incorrect result.

Fixing the testsuite only, will just keep this discrepancy (or incorrect 
string repr maybe) hidden for longer.

It is a different story, maybe, that thee test_file.py hasn't done more 
aggressive testing on filenames with backslashes.  This is far from 
being the only case that fails because of this.  Some is due to 
incorrectly coded tests.  Others are due to surprising python behaviour, 
like this one.

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


More information about the Python-bugs-list mailing list