[pypy-commit] pypy release-pypy2.7-5.x: Win32: remove rposix.fdlistdir()

arigo pypy.commits at gmail.com
Wed Nov 9 03:50:46 EST 2016


Author: Armin Rigo <arigo at tunes.org>
Branch: release-pypy2.7-5.x
Changeset: r88253:67c58d8dae1a
Date: 2016-11-08 19:15 +0100
http://bitbucket.org/pypy/pypy/changeset/67c58d8dae1a/

Log:	Win32: remove rposix.fdlistdir()

diff --git a/rpython/rlib/rposix.py b/rpython/rlib/rposix.py
--- a/rpython/rlib/rposix.py
+++ b/rpython/rlib/rposix.py
@@ -679,21 +679,22 @@
         raise OSError(error, "readdir failed")
     return result
 
-def fdlistdir(dirfd):
-    """
-    Like listdir(), except that the directory is specified as an open
-    file descriptor.
+if not _WIN32:
+    def fdlistdir(dirfd):
+        """
+        Like listdir(), except that the directory is specified as an open
+        file descriptor.
 
-    Note: fdlistdir() closes the file descriptor.  To emulate the
-    Python 3.x 'os.opendir(dirfd)', you must first duplicate the
-    file descriptor.
-    """
-    dirp = c_fdopendir(dirfd)
-    if not dirp:
-        error = get_saved_errno()
-        c_close(dirfd)
-        raise OSError(error, "opendir failed")
-    return _listdir(dirp, rewind=True)
+        Note: fdlistdir() closes the file descriptor.  To emulate the
+        Python 3.x 'os.opendir(dirfd)', you must first duplicate the
+        file descriptor.
+        """
+        dirp = c_fdopendir(dirfd)
+        if not dirp:
+            error = get_saved_errno()
+            c_close(dirfd)
+            raise OSError(error, "opendir failed")
+        return _listdir(dirp, rewind=True)
 
 @replace_os_function('listdir')
 @specialize.argtype(0)


More information about the pypy-commit mailing list