[issue9820] Windows : os.listdir(b'.') doesn't raise an error for unencodable filenames

STINNER Victor report at bugs.python.org
Fri Sep 10 23:30:22 CEST 2010


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

Patch:
 - Remove the bytes version of listdir(): reuse the unicode version but converts the filename to bytes using PyUnicode_EncodeFSDefault() if the directory name is not unicode
 - use Py_XDECREF(d) instead of Py_DECREF(d) at the end (because d=NULL on error)
 - use Py_CLEAR(d) instead of "Py_DECREF(d); d=NULL;"
 - remove "char namebuf[MAX_PATH+5]" buffer (use less stack memory)

----------
keywords: +patch
Added file: http://bugs.python.org/file18836/listdir_windows_bytes.patch

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


More information about the Python-bugs-list mailing list