[pypy-commit] pypy win32-stdlib: isatty should not raise exception

mattip noreply at buildbot.pypy.org
Sun Jun 10 23:21:26 CEST 2012


Author: mattip <matti.picus at gmail.com>
Branch: win32-stdlib
Changeset: r55561:a5d3b370bcbc
Date: 2012-06-10 18:41 +0300
http://bitbucket.org/pypy/pypy/changeset/a5d3b370bcbc/

Log:	isatty should not raise exception

diff --git a/pypy/rpython/module/ll_os.py b/pypy/rpython/module/ll_os.py
--- a/pypy/rpython/module/ll_os.py
+++ b/pypy/rpython/module/ll_os.py
@@ -1362,7 +1362,8 @@
         os_isatty = self.llexternal(underscore_on_windows+'isatty', [rffi.INT], rffi.INT)
 
         def isatty_llimpl(fd):
-            rposix.validate_fd(fd)
+            if not rposix.is_valid_fd(fd):
+                return False
             res = rffi.cast(lltype.Signed, os_isatty(rffi.cast(rffi.INT, fd)))
             return res != 0
 


More information about the pypy-commit mailing list