Author: Ronan Lamy <[email protected]>
Branch: less-stringly-ops
Changeset: r66444:bcdcd9864f9d
Date: 2013-08-21 01:44 +0200
http://bitbucket.org/pypy/pypy/changeset/bcdcd9864f9d/
Log: fix special-casing impl to match register_flow_sc doc
diff --git a/rpython/flowspace/objspace.py b/rpython/flowspace/objspace.py
--- a/rpython/flowspace/objspace.py
+++ b/rpython/flowspace/objspace.py
@@ -304,7 +304,7 @@
args_w = args.arguments_w +
self.unpackiterable(args.w_stararg)
else:
args_w = args.arguments_w
- return sc(self, args_w)
+ return sc(self, *args_w)
if args.keywords or isinstance(args.w_stararg, Variable):
shape, args_w = args.flatten()
diff --git a/rpython/flowspace/operation.py b/rpython/flowspace/operation.py
--- a/rpython/flowspace/operation.py
+++ b/rpython/flowspace/operation.py
@@ -27,10 +27,10 @@
@classmethod
def make_sc(cls):
- def sc_operator(space, args_w):
+ def sc_operator(space, *args_w):
if len(args_w) != cls.arity:
if cls is op.pow and len(args_w) == 2:
- args_w = args_w + [Constant(None)]
+ args_w = list(args_w) + [Constant(None)]
elif cls is op.getattr and len(args_w) == 3:
return space.frame.do_operation('simple_call',
Constant(getattr), *args_w)
else:
diff --git a/rpython/flowspace/specialcase.py b/rpython/flowspace/specialcase.py
--- a/rpython/flowspace/specialcase.py
+++ b/rpython/flowspace/specialcase.py
@@ -14,14 +14,14 @@
return decorate
@register_flow_sc(__import__)
-def sc_import(space, args_w):
+def sc_import(space, *args_w):
assert len(args_w) > 0 and len(args_w) <= 5, 'import needs 1 to 5
arguments'
assert all(isinstance(arg, Constant) for arg in args_w)
args = [arg.value for arg in args_w]
return space.import_name(*args)
@register_flow_sc(locals)
-def sc_locals(space, args):
+def sc_locals(_, *args):
raise Exception(
"A function calling locals() is not RPython. "
"Note that if you're translating code outside the PyPy "
@@ -31,8 +31,7 @@
"own project.")
@register_flow_sc(isinstance)
-def sc_isinstance(space, args):
- w_instance, w_type = args
+def sc_isinstance(space, w_instance, w_type):
if w_instance.foldable() and w_type.foldable():
return const(isinstance(w_instance.value, w_type.value))
return space.frame.do_operation('simple_call', const(isinstance),
diff --git a/rpython/rlib/objectmodel.py b/rpython/rlib/objectmodel.py
--- a/rpython/rlib/objectmodel.py
+++ b/rpython/rlib/objectmodel.py
@@ -282,7 +282,7 @@
return False
@register_flow_sc(we_are_translated)
-def sc_we_are_translated(space, args_w):
+def sc_we_are_translated(space):
return Constant(True)
diff --git a/rpython/rlib/rarithmetic.py b/rpython/rlib/rarithmetic.py
--- a/rpython/rlib/rarithmetic.py
+++ b/rpython/rlib/rarithmetic.py
@@ -516,10 +516,9 @@
r_uint = build_int('r_uint', False, LONG_BIT)
@register_flow_sc(r_uint)
-def sc_r_uint(space, args_w):
+def sc_r_uint(space, w_value):
# (normally, the 32-bit constant is a long, and is not allowed to
# show up in the flow graphs at all)
- [w_value] = args_w
if isinstance(w_value, Constant):
return Constant(r_uint(w_value.value))
return space.frame.do_operation('simple_call', const(r_uint), w_value)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit