Author: Ronan Lamy <[email protected]>
Branch: exc-later
Changeset: r76517:5e9c2ef07cb3
Date: 2015-03-23 13:28 +0000
http://bitbucket.org/pypy/pypy/changeset/5e9c2ef07cb3/

Log:    fixes

diff --git a/rpython/translator/simplify.py b/rpython/translator/simplify.py
--- a/rpython/translator/simplify.py
+++ b/rpython/translator/simplify.py
@@ -339,9 +339,9 @@
                         continue
                 if has_generic_case:
                     exits += exc_exits
-                if not exits:
-                    block.exitswitch = None
-                block.recloseblock(block.exits[0], *exits)
+                exits.insert(0, block.exits[0])
+            else:
+                exits = list(block.exits)
             if OverflowError in op.canraise:
                 if not any(issubclass(OverflowError, exit.exitcase)
                            for exit in block.exits[1:]):
@@ -349,18 +349,17 @@
                     v_exc = Variable('last_exc_value')
                     exit = Link([v_etype, v_exc], graph.exceptblock, 
OverflowError)
                     exit.extravars(v_etype, v_exc)
-                    exits = list(block.exits)
                     exits.append(exit)
-                    block.recloseblock(*exits)
             if Exception in op.canraise:
                 if block.exits[-1].exitcase is not Exception:
                     v_etype = Variable('last_exception')
                     v_exc = Variable('last_exc_value')
                     exit = Link([v_etype, v_exc], graph.exceptblock, Exception)
                     exit.extravars(v_etype, v_exc)
-                    exits = list(block.exits)
                     exits.append(exit)
-                    block.recloseblock(*exits)
+            block.recloseblock(*exits)
+            if len(exits) == 1:
+                block.exitswitch = None
 
 
 def remove_assertion_errors(graph):
diff --git a/rpython/translator/test/test_simplify.py 
b/rpython/translator/test/test_simplify.py
--- a/rpython/translator/test/test_simplify.py
+++ b/rpython/translator/test/test_simplify.py
@@ -71,7 +71,7 @@
     graph, _ = translate(f, [int, int])
     assert len(graph.startblock.operations) == 1
     assert graph.startblock.operations[0].opname == 'int_floordiv_ovf_zer'
-    assert len(graph.startblock.exits) == 2
+    assert len(graph.startblock.exits) == 3
     assert graph.startblock.exits[1].target is graph.returnblock
 
 def test_remove_direct_call_without_side_effects():
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to