[docs] Remove support of bytes paths in os.scandir() (issue 27998)
eryksun+pybugs at gmail.com
eryksun+pybugs at gmail.com
Sat Oct 8 11:59:16 EDT 2016
http://bugs.python.org/review/27998/diff/18802/Modules/posixmodule.c
File Modules/posixmodule.c (right):
http://bugs.python.org/review/27998/diff/18802/Modules/posixmodule.c#newcode11368
Modules/posixmodule.c:11368: static PyObject *
For consistency, here's this function using PyUnicode_FSDecoder as well:
static PyObject *
DirEntry_inode(DirEntry *self)
{
#ifdef MS_WINDOWS
if (!self->got_file_index) {
PyObject *unicode;
const wchar_t *path;
STRUCT_STAT stat;
int result;
if (!PyUnicode_FSDecoder(self->path, &unicode))
return NULL;
path = PyUnicode_AsUnicode(unicode);
result = LSTAT(path, &stat);
Py_DECREF(unicode);
if (result != 0)
return path_object_error(self->path);
self->win32_file_index = stat.st_ino;
self->got_file_index = 1;
}
return PyLong_FromLongLong((long long)self->win32_file_index);
#else /* POSIX */
#ifdef HAVE_LARGEFILE_SUPPORT
return PyLong_FromLongLong((long long)self->d_ino);
#else
return PyLong_FromLong((long)self->d_ino);
#endif
#endif
}
http://bugs.python.org/review/27998/
More information about the docs
mailing list