Author: Ronan Lamy <ronan.l...@gmail.com>
Branch: less-stringly-ops
Changeset: r66236:0ce93a50de7c
Date: 2013-08-09 11:19 +0100
http://bitbucket.org/pypy/pypy/changeset/0ce93a50de7c/

Log:    move arity check to HLOperation ctor

diff --git a/rpython/flowspace/operation.py b/rpython/flowspace/operation.py
--- a/rpython/flowspace/operation.py
+++ b/rpython/flowspace/operation.py
@@ -19,6 +19,8 @@
 class HLOperation(SpaceOperation):
     pure = False
     def __init__(self, *args):
+        if len(args) != self.arity:
+            raise TypeError(self.opname + " got the wrong number of arguments")
         self.args = list(args)
         self.result = Variable()
         self.offset = -1
@@ -40,16 +42,12 @@
         return sc_operator
 
     def eval(self, frame):
-        if len(self.args) != self.arity:
-            raise TypeError(self.opname + " got the wrong number of arguments")
         return frame.do_op(self)
 
 class PureOperation(HLOperation):
     pure = True
 
     def eval(self, frame):
-        if len(self.args) != self.arity:
-            raise TypeError(self.opname + " got the wrong number of arguments")
         args = []
         if all(w_arg.foldable() for w_arg in self.args):
             args = [w_arg.value for w_arg in self.args]
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to