[pypy-commit] pypy remove-objspace-options: Hack: the show() method on Blocks and Links now returns the

arigo pypy.commits at gmail.com
Mon Apr 25 06:55:56 EDT 2016


Author: Armin Rigo <arigo at tunes.org>
Branch: remove-objspace-options
Changeset: r83856:990299ffaac6
Date: 2016-04-25 12:48 +0200
http://bitbucket.org/pypy/pypy/changeset/990299ffaac6/

Log:	Hack: the show() method on Blocks and Links now returns the
	FunctionGraph object, too, which is useful in pdb

diff --git a/rpython/flowspace/model.py b/rpython/flowspace/model.py
--- a/rpython/flowspace/model.py
+++ b/rpython/flowspace/model.py
@@ -156,7 +156,7 @@
 
     def show(self):
         from rpython.translator.tool.graphpage import try_show
-        try_show(self)
+        return try_show(self)
 
     view = show
 
@@ -239,7 +239,7 @@
 
     def show(self):
         from rpython.translator.tool.graphpage import try_show
-        try_show(self)
+        return try_show(self)
 
     def _slowly_get_graph(self):
         import gc
diff --git a/rpython/translator/tool/graphpage.py b/rpython/translator/tool/graphpage.py
--- a/rpython/translator/tool/graphpage.py
+++ b/rpython/translator/tool/graphpage.py
@@ -405,13 +405,14 @@
 def try_show(obj):
     if isinstance(obj, FunctionGraph):
         obj.show()
+        return obj
     elif isinstance(obj, Link):
-        try_show(obj.prevblock)
+        return try_show(obj.prevblock)
     elif isinstance(obj, Block):
         graph = obj._slowly_get_graph()
         if isinstance(graph, FunctionGraph):
             graph.show()
-            return
+            return graph
         graph = IncompleteGraph(graph)
         SingleGraphPage(graph).display()
     else:


More information about the pypy-commit mailing list