[pypy-commit] pypy default: test, fix: os.isatty should not raise in windows
mattip
noreply at buildbot.pypy.org
Sun Jun 10 22:49:43 CEST 2012
Author: mattip <matti.picus at gmail.com>
Branch:
Changeset: r55554:fa1ecb3a52df
Date: 2012-06-10 23:49 +0300
http://bitbucket.org/pypy/pypy/changeset/fa1ecb3a52df/
Log: test, fix: os.isatty should not raise in windows
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
diff --git a/pypy/rpython/module/test/test_ll_os.py b/pypy/rpython/module/test/test_ll_os.py
--- a/pypy/rpython/module/test/test_ll_os.py
+++ b/pypy/rpython/module/test/test_ll_os.py
@@ -268,6 +268,14 @@
expected = -signal.SIGTERM
assert proc.wait() == expected
+def test_isatty():
+ try:
+ f = getllimpl(os.isatty)
+ except:
+ skip('No isatty in os')
+ assert f(-1) == False
+
+
class ExpectTestOs:
def setup_class(cls):
if not hasattr(os, 'ttyname'):
More information about the pypy-commit
mailing list