[pypy-svn] r43964 - in pypy/branch/kill-ctypes/pypy/module/termios: . test

fijal at codespeak.net fijal at codespeak.net
Fri Jun 1 07:47:33 CEST 2007


Author: fijal
Date: Fri Jun  1 07:47:33 2007
New Revision: 43964

Modified:
   pypy/branch/kill-ctypes/pypy/module/termios/interp_termios.py
   pypy/branch/kill-ctypes/pypy/module/termios/test/test_termios.py
Log:
Fix a bug in termios module and a test


Modified: pypy/branch/kill-ctypes/pypy/module/termios/interp_termios.py
==============================================================================
--- pypy/branch/kill-ctypes/pypy/module/termios/interp_termios.py	(original)
+++ pypy/branch/kill-ctypes/pypy/module/termios/interp_termios.py	Fri Jun  1 07:47:33 2007
@@ -33,7 +33,8 @@
             space.wrap(0), space.wrap(-1), space.wrap(1)))
         w_iflag, w_oflag, w_cflag, w_lflag, w_ispeed, w_ospeed = \
                  space.unpackiterable(tup_w)
-        cc = [space.str_w(c) for c in space.unpackiterable(w_cc)]
+        cc = [space.str_w(space.call_function(space.getattr(w_c,
+              space.wrap('__str__')))) for w_c in space.unpackiterable(w_cc)]
         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)

Modified: pypy/branch/kill-ctypes/pypy/module/termios/test/test_termios.py
==============================================================================
--- pypy/branch/kill-ctypes/pypy/module/termios/test/test_termios.py	(original)
+++ pypy/branch/kill-ctypes/pypy/module/termios/test/test_termios.py	Fri Jun  1 07:47:33 2007
@@ -60,6 +60,17 @@
         child = self.spawn(['--withmod-termios', str(f)])
         child.expect('ok!')
 
+    def test_tcsetattr(self):
+        source = py.code.Source("""
+        import termios
+        termios.tcsetattr(0, 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!'
+        """)
+        f = udir.join("test_tcsetattr.py")
+        f.write(source)
+        child = self.spawn(['--withmod-termios', str(f)])
+        child.expect('ok!')
+
 class AppTestTermios(object):
     def setup_class(cls):
         cls.space = gettestobjspace(usemodules=['termios'])



More information about the Pypy-commit mailing list