[issue3187] os.listdir can return byte strings

Guido van Rossum report at bugs.python.org
Fri Oct 3 22:55:28 CEST 2008


Guido van Rossum <guido at python.org> added the comment:

Thanks Amaury!

On to Georg for doc tweaks.  Summary:

- all the os.path functions now work on bytes as well, on all platforms
- only on Unix (but not OSX) do we recommend using bytes
- os.getcwdu() no longer exists
- os.getcwdb() returns bytes
- os.listdir(<str>) skips undecodable entries (previously it returned a
mixture of str and bytes instances)
- open() accepts bytes as filename

Stuff that didn't change but that you might want to mention:

- all the syscalls in os support bytes args; readlink() and listdir()
return bytes if the arg is bytes
- getcwd() may raise UnicodeDecodeError

Martin already documented sys.setfilesystemencoding().

----------
assignee: amaury.forgeotdarc -> georg.brandl

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


More information about the Python-bugs-list mailing list