[pypy-svn] pypy improve-unwrap_spec: unwrap_spec in _warnings, _stackless

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


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: improve-unwrap_spec
Changeset: r42066:899187b5c78c
Date: 2011-02-16 13:52 +0100
http://bitbucket.org/pypy/pypy/changeset/899187b5c78c/

Log:	unwrap_spec in _warnings, _stackless

diff --git a/pypy/module/_stackless/interp_stackless.py b/pypy/module/_stackless/interp_stackless.py
--- a/pypy/module/_stackless/interp_stackless.py
+++ b/pypy/module/_stackless/interp_stackless.py
@@ -1,7 +1,7 @@
 from pypy.interpreter.baseobjspace import Wrappable
 from pypy.interpreter.typedef import GetSetProperty, TypeDef
 from pypy.interpreter.typedef import interp_attrproperty, interp_attrproperty_w
-from pypy.interpreter.gateway import interp2app, ObjSpace, W_Root
+from pypy.interpreter.gateway import interp2app
 from pypy.interpreter.error import OperationError
 from pypy.rlib.rarithmetic import intmask
 import os

diff --git a/pypy/module/_stackless/interp_clonable.py b/pypy/module/_stackless/interp_clonable.py
--- a/pypy/module/_stackless/interp_clonable.py
+++ b/pypy/module/_stackless/interp_clonable.py
@@ -1,6 +1,6 @@
 from pypy.interpreter.error import OperationError
 from pypy.interpreter.typedef import TypeDef
-from pypy.interpreter.gateway import interp2app, ObjSpace, W_Root
+from pypy.interpreter.gateway import interp2app
 from pypy.module._stackless.interp_coroutine import AppCoroutine, AppCoState
 from pypy.module._stackless.interp_coroutine import makeStaticMethod
 from pypy.module._stackless.rcoroutine import AbstractThunk
@@ -58,8 +58,7 @@
     __new__    = interp2app(AppClonableCoroutine.descr_method__new__.im_func),
     getcurrent = interp2app(AppClonableCoroutine.w_getcurrent),
     clone      = interp2app(AppClonableCoroutine.w_clone),
-    __reduce__ = interp2app(AppClonableCoroutine.descr__reduce__,
-                            unwrap_spec=['self', ObjSpace]),
+    __reduce__ = interp2app(AppClonableCoroutine.descr__reduce__),
 )
 
 class AppClonableCoState(AppCoState):
@@ -105,4 +104,3 @@
     # we resume here twice.  The following would need explanations about
     # why it returns the correct thing in both the parent and the child...
     return space.wrap(thunk.newcoroutine)
-fork.unwrap_spec = [ObjSpace]

diff --git a/pypy/module/_stackless/interp_coroutine.py b/pypy/module/_stackless/interp_coroutine.py
--- a/pypy/module/_stackless/interp_coroutine.py
+++ b/pypy/module/_stackless/interp_coroutine.py
@@ -19,7 +19,7 @@
 from pypy.interpreter.argument import Arguments
 from pypy.interpreter.typedef import GetSetProperty, TypeDef
 from pypy.interpreter.typedef import interp_attrproperty, interp_attrproperty_w
-from pypy.interpreter.gateway import interp2app, ObjSpace, W_Root
+from pypy.interpreter.gateway import interp2app, unwrap_spec
 from pypy.interpreter.error import OperationError, operationerrfmt
 from pypy.interpreter.function import StaticMethod
 
@@ -348,8 +348,7 @@
 
 AppCoroutine.typedef = TypeDef("coroutine",
     __new__ = interp2app(AppCoroutine.descr_method__new__.im_func),
-    bind = interp2app(AppCoroutine.w_bind,
-                      unwrap_spec=['self', W_Root, Arguments]),
+    bind = interp2app(AppCoroutine.w_bind),
     switch = interp2app(AppCoroutine.w_switch),
     kill = interp2app(AppCoroutine.w_kill),
     throw = interp2app(AppCoroutine.w_throw),
@@ -362,10 +361,8 @@
     _framestack = GetSetProperty(w_descr__framestack),
     getcurrent = interp2app(AppCoroutine.w_getcurrent),
     getmain = interp2app(AppCoroutine.w_getmain),
-    __reduce__   = interp2app(AppCoroutine.descr__reduce__,
-                              unwrap_spec=['self', ObjSpace]),
-    __setstate__ = interp2app(AppCoroutine.descr__setstate__,
-                              unwrap_spec=['self', ObjSpace, W_Root]),
+    __reduce__   = interp2app(AppCoroutine.descr__reduce__),
+    __setstate__ = interp2app(AppCoroutine.descr__setstate__),
     __module__ = '_stackless',
 )
 
@@ -401,12 +398,10 @@
 
 def return_main(space):
     return AppCoroutine._get_state(space).main
-return_main.unwrap_spec = [ObjSpace]
 
 def get_stack_depth_limit(space):
     return space.wrap(rstack.get_stack_depth_limit())
-get_stack_depth_limit.unwrap_spec = [ObjSpace]
 
+ at unwrap_spec(limit=int)
 def set_stack_depth_limit(space, limit):
     rstack.set_stack_depth_limit(limit)
-set_stack_depth_limit.unwrap_spec = [ObjSpace, int]

diff --git a/pypy/module/_warnings/interp_warnings.py b/pypy/module/_warnings/interp_warnings.py
--- a/pypy/module/_warnings/interp_warnings.py
+++ b/pypy/module/_warnings/interp_warnings.py
@@ -1,5 +1,4 @@
 from pypy.interpreter.gateway import unwrap_spec
-from pypy.interpreter.baseobjspace import W_Root, ObjSpace
 from pypy.interpreter.error import OperationError
 
 def create_filter(space, w_category, action):
@@ -307,7 +306,7 @@
         space.call_function(
             w_show_fxn, w_message, w_category, w_filename, w_lineno)
 
- at unwrap_spec(ObjSpace, W_Root, W_Root, int)
+ at unwrap_spec(stacklevel=int)
 def warn(space, w_message, w_category=None, stacklevel=1):
     w_category = get_category(space, w_message, w_category);
     do_warn(space, w_message, w_category, stacklevel)
@@ -346,7 +345,7 @@
     w_source_line = space.getitem(w_source_list, space.wrap(lineno - 1))
     return w_source_line
 
- at unwrap_spec(ObjSpace, W_Root, W_Root, W_Root, int, W_Root, W_Root, W_Root)
+ at unwrap_spec(lineno=int)
 def warn_explicit(space, w_message, w_category, w_filename, lineno,
                   w_module=None, w_registry=None, w_module_globals=None):
 

diff --git a/pypy/module/_stackless/interp_greenlet.py b/pypy/module/_stackless/interp_greenlet.py
--- a/pypy/module/_stackless/interp_greenlet.py
+++ b/pypy/module/_stackless/interp_greenlet.py
@@ -1,6 +1,6 @@
 from pypy.interpreter.argument import Arguments
 from pypy.interpreter.typedef import GetSetProperty, TypeDef
-from pypy.interpreter.gateway import interp2app, ObjSpace, W_Root
+from pypy.interpreter.gateway import interp2app
 from pypy.interpreter.gateway import NoneNotWrapped
 from pypy.interpreter.error import OperationError
 
@@ -220,11 +220,9 @@
     w_greenlet.__flags__ = old_flags
 
 AppGreenlet.typedef = TypeDef("greenlet",
-    __new__ = interp2app(AppGreenlet.descr_method__new__.im_func,
-                         unwrap_spec=[ObjSpace, W_Root, Arguments]),
+    __new__ = interp2app(AppGreenlet.descr_method__new__.im_func),
     __init__ = interp2app(AppGreenlet.descr_method__init__),
-    switch = interp2app(AppGreenlet.w_switch,
-                        unwrap_spec=['self', 'args_w']),
+    switch = interp2app(AppGreenlet.w_switch),
     dead = GetSetProperty(AppGreenlet.w_get_is_dead),
     run = GetSetProperty(AppGreenlet.w_get_run,
                          AppGreenlet.w_set_run,


More information about the Pypy-commit mailing list