[pypy-commit] pypy expressions: create ExceptBlock class

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


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: expressions
Changeset: r74440:2328e7a3f341
Date: 2014-11-10 01:23 +0000
http://bitbucket.org/pypy/pypy/changeset/2328e7a3f341/

Log:	create ExceptBlock class

diff --git a/rpython/flowspace/model.py b/rpython/flowspace/model.py
--- a/rpython/flowspace/model.py
+++ b/rpython/flowspace/model.py
@@ -18,11 +18,7 @@
         self.returnblock = Block([return_var or Variable()])
         self.returnblock.operations = ()
         self.returnblock.exits = ()
-        # block corresponding to exception results
-        self.exceptblock = Block([Variable('etype'),   # exception class
-                                  Variable('evalue')])  # exception value
-        self.exceptblock.operations = ()
-        self.exceptblock.exits = ()
+        self.exceptblock = ExceptBlock()
         self.tag = None
 
     def getargs(self):
@@ -181,8 +177,6 @@
         else:
             if (not self.exits) and len(self.inputargs) == 1:
                 txt = "return block"
-            elif (not self.exits) and len(self.inputargs) == 2:
-                txt = "raise block"
             else:
                 txt = "codeless block"
         return txt
@@ -251,6 +245,17 @@
 
     view = show
 
+class ExceptBlock(Block):
+    def __init__(self):
+        self.inputargs = [Variable('etype'),   # exception class
+                          Variable('evalue')]  # exception value
+        self.operations = ()
+        self.exits = ()
+        self.exitswitch = None
+
+    def __str__(self):
+        return "raise block"
+
 
 class Variable(object):
     __slots__ = ["_name", "_nr", "annotation", "concretetype", "equals"]


More information about the pypy-commit mailing list