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

rlamy noreply at buildbot.pypy.org
Tue Nov 11 02:39:06 CET 2014


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

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)])
 
@@ -566,7 +567,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