[pypy-svn] pypy improve-unwrap_spec: progress: minimal_curses and termios

amauryfa commits-noreply at bitbucket.org
Wed Feb 16 19:19:28 CET 2011


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: improve-unwrap_spec
Changeset: r42060:029e0a0bba86
Date: 2011-02-16 12:08 +0100
http://bitbucket.org/pypy/pypy/changeset/029e0a0bba86/

Log:	progress: minimal_curses and termios

diff --git a/pypy/module/_minimal_curses/interp_curses.py b/pypy/module/_minimal_curses/interp_curses.py
--- a/pypy/module/_minimal_curses/interp_curses.py
+++ b/pypy/module/_minimal_curses/interp_curses.py
@@ -1,5 +1,5 @@
 
-from pypy.interpreter.baseobjspace import ObjSpace, W_Root
+from pypy.interpreter.baseobjspace import unwrap_spec
 from pypy.interpreter.error import OperationError
 from pypy.module._minimal_curses import _curses
 
@@ -40,6 +40,7 @@
     except _curses.error, e:
         raise curses_error(e.args[0])
 
+ at unwrap_spec(fd=int)
 def setupterm(space, w_termname=None, fd=-1):
     if fd == -1:
         w_stdout = space.getattr(space.getbuiltinmodule('sys'),
@@ -53,7 +54,6 @@
             _curses_setupterm(space.str_w(w_termname), fd)
     except curses_error, e:
         raise convert_error(space, e)
-setupterm.unwrap_spec = [ObjSpace, W_Root, int]
 
 class TermError(Exception):
     pass
@@ -75,6 +75,7 @@
     except _curses.error, e:
         raise curses_error(e.args[0])
 
+ at unwrap_spec(capname=str)
 def tigetstr(space, capname):
     try:
         result = _curses_tigetstr(capname)
@@ -83,12 +84,11 @@
     except curses_error, e:
         raise convert_error(space, e)
     return space.wrap(result)
-tigetstr.unwrap_spec = [ObjSpace, str]
 
+ at unwrap_spec(s=str)
 def tparm(space, s, args_w):
     args = [space.int_w(a) for a in args_w]
     try:
         return space.wrap(_curses_tparm(s, args))
     except curses_error, e:
         raise convert_error(space, e)
-tparm.unwrap_spec = [ObjSpace, str, 'args_w']

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
@@ -3,7 +3,7 @@
 little use of termios module on RPython level by itself
 """
 
-from pypy.interpreter.baseobjspace import ObjSpace, W_Root
+from pypy.interpreter.gateway import unwrap_spec
 from pypy.interpreter.error import OperationError, wrap_oserror
 from pypy.rpython.module import ll_termios
 from pypy.rlib.objectmodel import we_are_translated
@@ -20,6 +20,7 @@
     w_exception_class = space.getattr(w_module, space.wrap('error'))
     return wrap_oserror(space, error, w_exception_class=w_exception_class)
 
+ at unwrap_spec(fd=int, when=int)
 def tcsetattr(space, fd, when, w_attributes):
     w_iflag, w_oflag, w_cflag, w_lflag, w_ispeed, w_ospeed, w_cc = \
              space.unpackiterable(w_attributes, expected_length=7)
@@ -39,8 +40,8 @@
         rtermios.tcsetattr(fd, when, tup)
     except OSError, e:
         raise convert_error(space, e)
-tcsetattr.unwrap_spec = [ObjSpace, int, int, W_Root]
 
+ at unwrap_spec(fd=int)
 def tcgetattr(space, fd):
     try:
         tup = rtermios.tcgetattr(fd)
@@ -56,32 +57,31 @@
     w_cc = space.newlist(cc_w)
     l_w.append(w_cc)
     return space.newlist(l_w)
-tcgetattr.unwrap_spec = [ObjSpace, int]
 
+ at unwrap_spec(fd=int, duration=int)
 def tcsendbreak(space, fd, duration):
     try:
         termios.tcsendbreak(fd, duration)
     except OSError, e:
         raise convert_error(space, e)
-tcsendbreak.unwrap_spec = [ObjSpace, int, int]
 
+ at unwrap_spec(fd=int)
 def tcdrain(space, fd):
     try:
         termios.tcdrain(fd)
     except OSError, e:
         raise convert_error(space, e)
-tcdrain.unwrap_spec = [ObjSpace, int]
 
+ at unwrap_spec(fd=int, queue=int)
 def tcflush(space, fd, queue):
     try:
         termios.tcflush(fd, queue)
     except OSError, e:
         raise convert_error(space, e)
-tcflush.unwrap_spec = [ObjSpace, int, int]
 
+ at unwrap_spec(fd=int, action=int)
 def tcflow(space, fd, action):
     try:
         termios.tcflow(fd, action)
     except OSError, e:
         raise convert_error(space, e)
-tcflow.unwrap_spec = [ObjSpace, int, int]


More information about the Pypy-commit mailing list