[pypy-commit] pypy expressions-2: Make sure that inputargs contains only Variables

rlamy noreply at buildbot.pypy.org
Mon Nov 17 19:59:16 CET 2014


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: expressions-2
Changeset: r74557:214a3579014f
Date: 2014-11-09 05:27 +0000
http://bitbucket.org/pypy/pypy/changeset/214a3579014f/

Log:	Make sure that inputargs contains only Variables

diff --git a/rpython/flowspace/model.py b/rpython/flowspace/model.py
--- a/rpython/flowspace/model.py
+++ b/rpython/flowspace/model.py
@@ -163,7 +163,7 @@
                 exits blockcolor""".split()
 
     def __init__(self, inputargs):
-        self.inputargs = list(inputargs)  # mixed list of variable/const XXX
+        self.inputargs = list(inputargs)  # list of Variable
         self.operations = []              # list of SpaceOperation(s)
         self.exitswitch = None            # a variable or
                                           #  Constant(last_exception), see below
@@ -197,7 +197,8 @@
         "Return all variables mentioned in this Block."
         result = self.inputargs[:]
         for op in self.operations:
-            result += op.args
+            for arg in op.args:
+                result.extend(arg.dependencies)
             result.append(op.result)
         return uniqueitems([w for w in result if isinstance(w, Variable)])
 
@@ -564,7 +565,7 @@
             assert block.exits == ()
 
         def definevar(v, only_in_link=None):
-            assert isinstance(v, Variable)
+            assert type(v) is Variable
             assert v not in vars, "duplicate variable %r" % (v,)
             assert v not in vars_previous_blocks, (
                 "variable %r used in more than one block" % (v,))


More information about the pypy-commit mailing list