diff options
author | Guido van Rossum <guido@python.org> | 1998-08-06 03:23:32 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1998-08-06 03:23:32 (GMT) |
commit | 617bc19e3d7911c478e8313e59a702b99ab440f7 (patch) | |
tree | f5f164d5d0e1e0ae52c7c9edb694c098a6c66455 /Modules/posixmodule.c | |
parent | 954e3cab0a04142d6d0d705c756ac6d85b2976a0 (diff) | |
download | cpython-617bc19e3d7911c478e8313e59a702b99ab440f7.zip cpython-617bc19e3d7911c478e8313e59a702b99ab440f7.tar.gz cpython-617bc19e3d7911c478e8313e59a702b99ab440f7.tar.bz2 |
In Win32 version of listdir(), when FindFirstFile() returns
ERROR_FILE_NOT_FOUND, return an empty list instead of raising an
exception.
Diffstat (limited to 'Modules/posixmodule.c')
-rw-r--r-- | Modules/posixmodule.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 6708df8..8174890 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -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 { |