Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

change function name

--HG--
branch : win32-cleanup2
  • Loading branch information...
commit d79eb7ea9e3dbfcbeea8be447ab659560e975a5b 1 parent fbe94f7
@mattip mattip authored
View
4 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 @@ class CConfig_constants:
_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)
View
8 pypy/rlib/rposix.py
@@ -98,16 +98,16 @@ def set_errno(errno):
_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 @@ def closerange(fd_low, fd_high):
# 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
View
2  pypy/rlib/streamio.py
@@ -190,7 +190,7 @@ def __init__(self, message):
# 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):
View
10 pypy/rlib/test/test_rposix.py
@@ -132,14 +132,12 @@ def g():
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
Please sign in to comment.
Something went wrong with that request. Please try again.