[pypy-commit] pypy py3k: Fixes in termios module
amauryfa
noreply at buildbot.pypy.org
Tue Jan 17 00:26:35 CET 2012
Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: py3k
Changeset: r51371:4a6fb1817feb
Date: 2012-01-16 23:53 +0100
http://bitbucket.org/pypy/pypy/changeset/4a6fb1817feb/
Log: Fixes in termios module
diff --git a/pypy/module/termios/interp_termios.py b/pypy/module/termios/interp_termios.py
--- a/pypy/module/termios/interp_termios.py
+++ b/pypy/module/termios/interp_termios.py
@@ -24,15 +24,11 @@
fd = space.c_filedescriptor_w(w_fd)
w_iflag, w_oflag, w_cflag, w_lflag, w_ispeed, w_ospeed, w_cc = \
space.unpackiterable(w_attributes, expected_length=7)
- w_builtin = space.getbuiltinmodule('__builtin__')
cc = []
for w_c in space.unpackiterable(w_cc):
if space.is_true(space.isinstance(w_c, space.w_int)):
- ch = space.call_function(space.getattr(w_builtin,
- space.wrap('chr')), w_c)
- cc.append(space.str_w(ch))
- else:
- cc.append(space.str_w(w_c))
+ w_c = space.call(space.w_bytes, space.newlist([w_c]))
+ cc.append(space.bytes_w(w_c))
tup = (space.int_w(w_iflag), space.int_w(w_oflag),
space.int_w(w_cflag), space.int_w(w_lflag),
space.int_w(w_ispeed), space.int_w(w_ospeed), cc)
diff --git a/pypy/module/termios/test/test_termios.py b/pypy/module/termios/test/test_termios.py
--- a/pypy/module/termios/test/test_termios.py
+++ b/pypy/module/termios/test/test_termios.py
@@ -23,7 +23,7 @@
def _spawn(self, *args, **kwds):
print 'SPAWN:', args, kwds
- child = self.pexpect.spawn(*args, **kwds)
+ child = self.pexpect.spawn(timeout=600, *args, **kwds)
child.logfile = sys.stdout
return child
@@ -53,7 +53,7 @@
termios.tcdrain(2)
termios.tcflush(2, termios.TCIOFLUSH)
termios.tcflow(2, termios.TCOON)
- print 'ok!'
+ print('ok!')
""")
f = udir.join("test_tcall.py")
f.write(source)
@@ -65,7 +65,7 @@
import sys
import termios
termios.tcsetattr(sys.stdin, 1, [16640, 4, 191, 2608, 15, 15, ['\x03', '\x1c', '\x7f', '\x15', '\x04', 0, 1, '\x00', '\x11', '\x13', '\x1a', '\x00', '\x12', '\x0f', '\x17', '\x16', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00']])
- print 'ok!'
+ print('ok!')
""")
f = udir.join("test_tcsetattr.py")
f.write(source)
@@ -76,9 +76,9 @@
source = py.code.Source("""
import termios
import fcntl
- lgt = len(fcntl.ioctl(2, termios.TIOCGWINSZ, '\000'*8))
+ lgt = len(fcntl.ioctl(2, termios.TIOCGWINSZ, b'\000'*8))
assert lgt == 8
- print 'ok!'
+ print('ok!')
""")
f = udir.join("test_ioctl_termios.py")
f.write(source)
@@ -97,7 +97,7 @@
assert len([i for i in f[-1] if isinstance(i, int)]) == 2
assert isinstance(f[-1][termios.VMIN], int)
assert isinstance(f[-1][termios.VTIME], int)
- print 'ok!'
+ print('ok!')
""")
f = udir.join("test_ioctl_termios.py")
f.write(source)
More information about the pypy-commit
mailing list