[issue3187] os.listdir can return byte strings

STINNER Victor report at bugs.python.org
Mon Sep 29 14:51:57 CEST 2008


STINNER Victor <victor.stinner at haypocalc.com> added the comment:

About os.getcwd(), another solution is merge_os_getcwd_getcwdu.patch: 
os.getcwd() always return unicode string and raise an error on unicode 
decode error. Wheras os.getcwd(bytes=True) always return bytes. 

The old function os.getcwdu() is removed since os.getcwd() already 
return unicode string.

Note: current version of os.getcwd() uses the wrong encoding to 
conversion bytes to unicode: it uses PyUnicode_FromString() instead of 
PyUnicode_Decode(..., Py_FileSystemDefaultEncoding, "strict") (as does 
getcwdu()).

Added file: http://bugs.python.org/file11652/merge_os_getcwd_getcwdu.patch

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


More information about the Python-bugs-list mailing list