mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
In Win32 version of listdir(), when FindFirstFile() returns
ERROR_FILE_NOT_FOUND, return an empty list instead of raising an exception.
This commit is contained in:
parent
954e3cab0a
commit
617bc19e3d
1 changed files with 2 additions and 0 deletions
|
@ -644,6 +644,8 @@ posix_listdir(self, args)
|
|||
hFindFile = FindFirstFile(namebuf, &FileData);
|
||||
if (hFindFile == INVALID_HANDLE_VALUE) {
|
||||
errno = GetLastError();
|
||||
if (errno == ERROR_FILE_NOT_FOUND)
|
||||
return PyList_New(0);
|
||||
return posix_error();
|
||||
}
|
||||
do {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue