Author: Matti Picus <matti.pi...@gmail.com>
Branch: py3.5
Changeset: r93817:46506daf1ecd
Date: 2018-02-12 22:23 -0500
http://bitbucket.org/pypy/pypy/changeset/46506daf1ecd/

Log:    remove traces of is_valid_fd since merge of msvc14

diff --git a/pypy/module/posix/app_posix.py b/pypy/module/posix/app_posix.py
--- a/pypy/module/posix/app_posix.py
+++ b/pypy/module/posix/app_posix.py
@@ -93,10 +93,6 @@
     f_flag = structseqfield(8)
     f_namemax = structseqfield(9)
 
-# Capture file.fdopen at import time, as some code replaces
-# __builtins__.file with a custom function.
-_fdopen = file.fdopen
-
 
 class uname_result(metaclass=structseqtype):
 
@@ -117,14 +113,6 @@
     columns  = structseqfield(0, "width of the terminal window in characters")
     lines = structseqfield(1, "height of the terminal window in characters")
 
-if osname == 'posix':
-    # POSIX: we want to check the file descriptor when fdopen() is called,
-    # not later when we read or write data.  So we call fstat(), letting
-    # it raise if fd is invalid.
-    _validate_fd = posix.fstat
-else:
-    _validate_fd = validate_fd
-
 
 class times_result(metaclass=structseqtype):
 
diff --git a/pypy/module/posix/interp_posix.py 
b/pypy/module/posix/interp_posix.py
--- a/pypy/module/posix/interp_posix.py
+++ b/pypy/module/posix/interp_posix.py
@@ -2223,8 +2223,9 @@
     Return a string describing the encoding of the device if the output
     is a terminal; else return None.
     """
-    if not (rposix.is_valid_fd(fd) and os.isatty(fd)):
-        return space.w_None
+    with rposix.FdValidator(fd):
+        if not (os.isatty(fd)):
+            return space.w_None
     if _WIN32:
         if fd == 0:
             ccp = rwin32.GetConsoleCP()
diff --git a/pypy/module/signal/interp_signal.py 
b/pypy/module/signal/interp_signal.py
--- a/pypy/module/signal/interp_signal.py
+++ b/pypy/module/signal/interp_signal.py
@@ -259,8 +259,6 @@
                     "signal.set_wakeup_fd is not implemented on Windows")
 
     if fd != -1:
-        if not rposix.is_valid_fd(fd):
-            raise oefmt(space.w_ValueError, "invalid fd")
         try:
             os.fstat(fd)
             flags = rposix.get_status_flags(fd)
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to