[pypy-commit] pypy anntype: Try to clean up follow_link() a bit

rlamy noreply at buildbot.pypy.org
Tue Nov 10 18:24:21 EST 2015


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: anntype
Changeset: r80624:c2a6e9cfb77c
Date: 2015-11-08 07:14 +0000
http://bitbucket.org/pypy/pypy/changeset/c2a6e9cfb77c/

Log:	Try to clean up follow_link() a bit

diff --git a/rpython/annotator/annrpython.py b/rpython/annotator/annrpython.py
--- a/rpython/annotator/annrpython.py
+++ b/rpython/annotator/annrpython.py
@@ -500,15 +500,14 @@
                 issubclass(link.exitcase, BaseException)):
             assert v_last_exc_type and v_last_exc_value
             s_last_exc_value = self.bookkeeper.valueoftype(link.exitcase)
-            s_last_exc_type = annmodel.SomeType()
-            if isinstance(v_last_exc_type, Constant):
-                s_last_exc_type.const = v_last_exc_type.value
-            s_last_exc_type.is_type_of = [v_last_exc_value]
+            if isinstance(v_last_exc_value, Variable):
+                self.setbinding(v_last_exc_value, s_last_exc_value)
+
 
             if isinstance(v_last_exc_type, Variable):
-                self.setbinding(v_last_exc_type, s_last_exc_type)
-            if isinstance(v_last_exc_value, Variable):
-                self.setbinding(v_last_exc_value, s_last_exc_value)
+                s_etype = annmodel.SomeType()
+                s_etype.is_type_of = [v_last_exc_value]
+                self.setbinding(v_last_exc_type, s_etype)
 
             s_last_exc_type = annmodel.SomeType()
             if isinstance(v_last_exc_type, Constant):


More information about the pypy-commit mailing list