Author: Maciej Fijalkowski <[email protected]>
Branch: remove-list-smm
Changeset: r62631:a8616e7bc663
Date: 2013-03-21 17:53 -0700
http://bitbucket.org/pypy/pypy/changeset/a8616e7bc663/
Log: (arigo, fijal) fix fix fix
diff --git a/pypy/interpreter/gateway.py b/pypy/interpreter/gateway.py
--- a/pypy/interpreter/gateway.py
+++ b/pypy/interpreter/gateway.py
@@ -466,6 +466,7 @@
def __init__(self, default_value):
self.default_value = default_value
+
def build_unwrap_spec(func, argnames, self_type=None):
"""build the list of parameter unwrap spec for the function.
"""
diff --git a/pypy/module/parser/__init__.py b/pypy/module/parser/__init__.py
--- a/pypy/module/parser/__init__.py
+++ b/pypy/module/parser/__init__.py
@@ -17,12 +17,12 @@
'expr' : 'pyparser.expr',
'issuite' : 'pyparser.issuite',
'isexpr' : 'pyparser.isexpr',
- 'STType' : 'pyparser.STType',
+ 'STType' : 'pyparser.W_STType',
'ast2tuple' : 'pyparser.st2tuple',
'st2tuple' : 'pyparser.st2tuple',
'ast2list' : 'pyparser.st2list',
'ast2tuple' : 'pyparser.st2tuple',
- 'ASTType' : 'pyparser.STType',
+ 'ASTType' : 'pyparser.W_STType',
'compilest' : 'pyparser.compilest',
'compileast' : 'pyparser.compilest',
'ParserError' : 'space.new_exception_class("parser.ParserError")',
diff --git a/pypy/module/parser/pyparser.py b/pypy/module/parser/pyparser.py
--- a/pypy/module/parser/pyparser.py
+++ b/pypy/module/parser/pyparser.py
@@ -8,7 +8,7 @@
from rpython.rlib.objectmodel import specialize
-class STType(W_Root):
+class W_STType(W_Root):
def __init__(self, tree, mode):
self.tree = tree
self.mode = mode
@@ -62,12 +62,12 @@
e.wrap_info(space))
return space.wrap(result)
-STType.typedef = TypeDef("parser.st",
- issuite=interp2app(STType.descr_issuite),
- isexpr=interp2app(STType.descr_isexpr),
- totuple=interp2app(STType.descr_totuple),
- tolist=interp2app(STType.descr_tolist),
- compile=interp2app(STType.descr_compile)
+W_STType.typedef = TypeDef("parser.st",
+ issuite=interp2app(W_STType.descr_issuite),
+ isexpr=interp2app(W_STType.descr_isexpr),
+ totuple=interp2app(W_STType.descr_totuple),
+ tolist=interp2app(W_STType.descr_tolist),
+ compile=interp2app(W_STType.descr_compile)
)
@@ -82,7 +82,7 @@
except error.SyntaxError, e:
raise OperationError(space.w_SyntaxError,
e.wrap_info(space))
- return space.wrap(STType(tree, mode))
+ return space.wrap(W_STType(tree, mode))
@unwrap_spec(source=str)
@@ -95,22 +95,22 @@
return parse_python(space, source, 'eval')
-@unwrap_spec(st=STType)
-def isexpr(space, st):
- return space.call_method(st, "isexpr")
+@unwrap_spec(w_st=W_STType)
+def isexpr(space, w_st):
+ return w_st.descr_isexpr(space)
-@unwrap_spec(st=STType)
-def issuite(space, st):
- return space.call_method(st, "issuite")
+@unwrap_spec(w_st=W_STType)
+def issuite(space, w_st):
+ return w_st.descr_issuite(space)
-@unwrap_spec(st=STType)
-def st2tuple(space, st, __args__):
- return space.call_args(space.getattr(st, space.wrap("totuple")), __args__)
+@unwrap_spec(w_st=W_STType)
+def st2tuple(space, w_st, __args__):
+ return space.call_args(space.getattr(w_st, space.wrap("totuple")),
__args__)
-@unwrap_spec(st=STType)
-def st2list(space, st, __args__):
- return space.call_args(space.getattr(st, space.wrap("tolist")), __args__)
+@unwrap_spec(w_st=W_STType)
+def st2list(space, w_st, __args__):
+ return space.call_args(space.getattr(w_st, space.wrap("tolist")), __args__)
-@unwrap_spec(st=STType)
-def compilest(space, st, __args__):
- return space.call_args(space.getattr(st, space.wrap("compile")), __args__)
+@unwrap_spec(w_st=W_STType)
+def compilest(space, w_st, __args__):
+ return space.call_args(space.getattr(w_st, space.wrap("compile")),
__args__)
diff --git a/pypy/module/pypyjit/interp_resop.py
b/pypy/module/pypyjit/interp_resop.py
--- a/pypy/module/pypyjit/interp_resop.py
+++ b/pypy/module/pypyjit/interp_resop.py
@@ -134,15 +134,18 @@
getint = interp2app(WrappedBox.descr_getint),
)
-@unwrap_spec(num=int, offset=int, repr=str, res=WrappedBox)
-def descr_new_resop(space, w_tp, num, w_args, res, offset=-1,
+@unwrap_spec(num=int, offset=int, repr=str, w_res=W_Root)
+def descr_new_resop(space, w_tp, num, w_args, w_res, offset=-1,
repr=''):
args = [space.interp_w(WrappedBox, w_arg).llbox for w_arg in
space.listview(w_args)]
- if res is None:
+ if space.is_none(w_res):
llres = jit_hooks.emptyval()
else:
- llres = res.llbox
+ if not isinstance(w_res, WrappedBox):
+ raise OperationError(space.w_TypeError, space.wrap(
+ "expected box type, got %s" % space.type(w_res)))
+ llres = w_res.llbox
return WrappedOp(jit_hooks.resop_new(num, args, llres), offset, repr)
@unwrap_spec(repr=str, jd_name=str, call_depth=int, call_id=int)
@@ -178,9 +181,9 @@
def descr_getarg(self, space, no):
return WrappedBox(jit_hooks.resop_getarg(self.op, no))
- @unwrap_spec(no=int, box=WrappedBox)
- def descr_setarg(self, space, no, box):
- jit_hooks.resop_setarg(self.op, no, box.llbox)
+ @unwrap_spec(no=int, w_box=WrappedBox)
+ def descr_setarg(self, space, no, w_box):
+ jit_hooks.resop_setarg(self.op, no, w_box.llbox)
def descr_getresult(self, space):
return WrappedBox(jit_hooks.resop_getresult(self.op))
diff --git a/pypy/objspace/std/bytearrayobject.py
b/pypy/objspace/std/bytearrayobject.py
--- a/pypy/objspace/std/bytearrayobject.py
+++ b/pypy/objspace/std/bytearrayobject.py
@@ -571,7 +571,7 @@
w_bytearray.data += makebytearraydata_w(space, w_other)
def inplace_add__Bytearray_Bytearray(space, w_bytearray1, w_bytearray2):
- list_extend__Bytearray_Bytearray(space, w_bytearray1, w_bytearray2)
+ bytearray_extend__Bytearray_Bytearray(space, w_bytearray1, w_bytearray2)
return w_bytearray1
def inplace_add__Bytearray_ANY(space, w_bytearray1, w_iterable2):
diff --git a/pypy/objspace/std/test/test_proxy_internals.py
b/pypy/objspace/std/test/test_proxy_internals.py
--- a/pypy/objspace/std/test/test_proxy_internals.py
+++ b/pypy/objspace/std/test/test_proxy_internals.py
@@ -140,10 +140,13 @@
def test_proxy_get(self):
from __pypy__ import tproxy, get_tproxy_controller
- l = [1,2,3]
+
+ class A(object):
+ pass
+
def f(name, *args, **kwargs):
- return getattr(l, name)(*args, **kwargs)
- lst = tproxy(list, f)
+ pass
+ lst = tproxy(A, f)
assert get_tproxy_controller(lst) is f
def test_proxy_file(self):
diff --git a/pypy/objspace/std/test/test_proxy_object.py
b/pypy/objspace/std/test/test_proxy_object.py
--- a/pypy/objspace/std/test/test_proxy_object.py
+++ b/pypy/objspace/std/test/test_proxy_object.py
@@ -34,8 +34,9 @@
def test_simple_obj(self):
class AT(self.A):
pass
-
+
c = self.Controller(self.A())
+ obj = self.proxy(self.A, c.perform)
obj = self.proxy(AT, c.perform)
assert type(obj) is AT
diff --git a/pypy/objspace/std/transparent.py b/pypy/objspace/std/transparent.py
--- a/pypy/objspace/std/transparent.py
+++ b/pypy/objspace/std/transparent.py
@@ -37,7 +37,7 @@
PyCode, GeneratorIterator
if not space.is_true(space.callable(w_controller)):
raise OperationError(space.w_TypeError, space.wrap("controller should
be function"))
-
+
if isinstance(w_type, W_TypeObject):
if space.is_true(space.issubtype(w_type,
space.gettypeobject(Function.typedef))):
return W_TransparentFunction(space, w_type, w_controller)
@@ -57,7 +57,7 @@
for k, v in type_cache.cache:
if w_lookup == k:
return v(space, w_type, w_controller)
- raise operationerrfmt(space.w_TypeError,
+ raise operationerrfmt(space.w_TypeError,
"'%s' object could not be wrapped (YET)",
w_type.getname(space))
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit