[pypy-commit] pypy win32-cleanup2: change function name

mattip noreply at buildbot.pypy.org
Mon May 7 20:38:09 CEST 2012


Author: Matti Picus <matti.picus at gmail.com>
Branch: win32-cleanup2
Changeset: r54945:b6322f9f765a
Date: 2012-05-07 21:37 +0300
http://bitbucket.org/pypy/pypy/changeset/b6322f9f765a/

Log:	change function name

diff --git a/pypy/module/cpyext/api.py b/pypy/module/cpyext/api.py
--- a/pypy/module/cpyext/api.py
+++ b/pypy/module/cpyext/api.py
@@ -26,7 +26,7 @@
 from pypy.module.__builtin__.interp_classobj import W_ClassObject
 from pypy.module.__builtin__.interp_memoryview import W_MemoryView
 from pypy.rlib.entrypoint import entrypoint
-from pypy.rlib.rposix import _validate_fd
+from pypy.rlib.rposix import is_valid_fd
 from pypy.rlib.unroll import unrolling_iterable
 from pypy.rlib.objectmodel import specialize
 from pypy.rlib.exports import export_struct
@@ -90,7 +90,7 @@
 
 _fclose = rffi.llexternal('fclose', [FILEP], rffi.INT)
 def fclose(fp):
-    if not _validate_fd(fileno(fp)):
+    if not is_valid_fd(fileno(fp)):
         return -1
     return _fclose(fp)
 
diff --git a/pypy/rlib/rposix.py b/pypy/rlib/rposix.py
--- a/pypy/rlib/rposix.py
+++ b/pypy/rlib/rposix.py
@@ -98,16 +98,16 @@
     _set_errno(rffi.cast(INT, errno))
 
 if os.name == 'nt':
-    _validate_fd = rffi.llexternal(
+    is_valid_fd = rffi.llexternal(
         "_PyVerify_fd", [rffi.INT], rffi.INT,
         compilation_info=errno_eci,
         )
     @jit.dont_look_inside
     def validate_fd(fd):
-        if not _validate_fd(fd):
+        if not is_valid_fd(fd):
             raise OSError(get_errno(), 'Bad file descriptor')
 else:
-    def _validate_fd(fd):
+    def is_valid_fd(fd):
         return 1
 
     def validate_fd(fd):
@@ -117,7 +117,7 @@
     # this behaves like os.closerange() from Python 2.6.
     for fd in xrange(fd_low, fd_high):
         try:
-            if _validate_fd(fd):
+            if is_valid_fd(fd):
                 os.close(fd)
         except OSError:
             pass
diff --git a/pypy/rlib/streamio.py b/pypy/rlib/streamio.py
--- a/pypy/rlib/streamio.py
+++ b/pypy/rlib/streamio.py
@@ -190,7 +190,7 @@
     # See PyPyTarget.target() in targetpypystandalone.py
     def _setfd_binary(fd):
         #Allow this to succeed on invalid fd's
-        if rposix._validate_fd(fd):
+        if rposix.is_valid_fd(fd):
             _setmode(fd, os.O_BINARY)
 
     def ftruncate_win32(fd, size):
diff --git a/pypy/rlib/test/test_rposix.py b/pypy/rlib/test/test_rposix.py
--- a/pypy/rlib/test/test_rposix.py
+++ b/pypy/rlib/test/test_rposix.py
@@ -132,14 +132,12 @@
             except Exception:
                 pass
 
-    def test_validate_fd(self):
+    def test_is_valid_fd(self):
         if os.name != 'nt':
             skip('relevant for windows only')
-        assert rposix._validate_fd(0) == 1
+        assert rposix.is_valid_fd(0) == 1
         fid = open(str(udir.join('validate_test.txt')), 'w')
         fd = fid.fileno()
-        assert rposix._validate_fd(fd) == 1
+        assert rposix.is_valid_fd(fd) == 1
         fid.close()
-        assert rposix._validate_fd(fd) == 0
-
-
+        assert rposix.is_valid_fd(fd) == 0


More information about the pypy-commit mailing list