[pypy-commit] pypy default: Replace a dict with a set.

alex_gaynor noreply at buildbot.pypy.org
Fri Jul 12 05:22:50 CEST 2013


Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch: 
Changeset: r65365:4dd7f1d50603
Date: 2013-07-12 13:22 +1000
http://bitbucket.org/pypy/pypy/changeset/4dd7f1d50603/

Log:	Replace a dict with a set.

diff --git a/rpython/translator/backendopt/inline.py b/rpython/translator/backendopt/inline.py
--- a/rpython/translator/backendopt/inline.py
+++ b/rpython/translator/backendopt/inline.py
@@ -32,22 +32,22 @@
 
 
 def collect_called_graphs(graph, translator, include_oosend=True):
-    graphs_or_something = {}
+    graphs_or_something = set()
     for block in graph.iterblocks():
         for op in block.operations:
             if op.opname == "direct_call":
                 graph = get_graph(op.args[0], translator)
                 if graph is not None:
-                    graphs_or_something[graph] = True
+                    graphs_or_something.add(graph)
                 else:
-                    graphs_or_something[op.args[0]] = True
+                    graphs_or_something.add(op.args[0])
             if op.opname == "indirect_call":
                 graphs = op.args[-1].value
                 if graphs is None:
-                    graphs_or_something[op.args[0]] = True
+                    graphs_or_something.add(op.args[0])
                 else:
                     for graph in graphs:
-                        graphs_or_something[graph] = True
+                        graphs_or_something.add(graph)
             if op.opname == 'oosend' and include_oosend:
                 meth = get_meth_from_oosend(op)
                 if hasattr(meth, 'graph'):
@@ -56,7 +56,7 @@
                     key = CanRaise(meth._can_raise)
                 else:
                     key = op.args[0]
-                graphs_or_something[key] = True
+                graphs_or_something.add(key)
     return graphs_or_something
 
 def iter_callsites(graph, calling_what):


More information about the pypy-commit mailing list