[issue7697] os.getcwd() should raise UnicodeDecodeError for arbitrary bytes

2010-01-13 Thread Philip Jenvey
Philip Jenvey added the comment: Right, this is an intentional change in behavior in Python 3.1, non-decodable characters are now decoded to utf8b (via the surrogateescape error handler). The unicode string returned from getcwd furthermore can be passsed around to other fs functions, they sim

[issue7697] os.getcwd() should raise UnicodeDecodeError for arbitrary bytes

2010-01-13 Thread Florent Xicluna
Florent Xicluna added the comment: Actually, it is the documented behaviour. http://docs.python.org/py3k/library/os.html#file-names-command-line-arguments-and-environment-variables >>> b'\xe7'.decode('utf-8', 'surrogateescape') '\udce7' -- resolution: -> invalid stage: -> committed/r

[issue7697] os.getcwd() should raise UnicodeDecodeError for arbitrary bytes

2010-01-13 Thread Florent Xicluna
New submission from Florent Xicluna : When the current working directory is not decodable, the os.getcwd() function should raise an error. >>> sys.getfilesystemencoding() 'utf-8' >>> cwd=b'/tmp/\xe7' >>> os.mkdir(cwd); os.chdir(cwd) >>> os.getcwdb() b'/tmp/\xe7' >>> os.getcwd() # Should raise