Author: Ronan Lamy <ronan.l...@gmail.com>
Branch: less-stringly-ops
Changeset: r66231:91df4586840d
Date: 2013-08-09 03:02 +0100
http://bitbucket.org/pypy/pypy/changeset/91df4586840d/

Log:    refactor and rename FSFrame.handle_implicit_exceptions

diff --git a/rpython/flowspace/flowcontext.py b/rpython/flowspace/flowcontext.py
--- a/rpython/flowspace/flowcontext.py
+++ b/rpython/flowspace/flowcontext.py
@@ -453,10 +453,11 @@
 
     def do_op(self, operator, *args_w):
         w_result = self.do_operation(operator.name, *args_w)
-        self.handle_implicit_exceptions(operator.canraise)
+        if operator.canraise:
+            self.guessexception(operator.canraise)
         return w_result
 
-    def handle_implicit_exceptions(self, exceptions):
+    def guessexception(self, exceptions):
         """
         Catch possible exceptions implicitly.
 
@@ -465,9 +466,7 @@
         even if the interpreter re-raises the exception, it will not be the
         same ImplicitOperationError instance internally.
         """
-        if not exceptions:
-            return
-        return self.recorder.guessexception(self, *exceptions)
+        self.recorder.guessexception(self, *exceptions)
 
     def build_flow(self):
         graph = self.graph
diff --git a/rpython/flowspace/objspace.py b/rpython/flowspace/objspace.py
--- a/rpython/flowspace/objspace.py
+++ b/rpython/flowspace/objspace.py
@@ -265,7 +265,7 @@
                     frame.replace_in_stack(it, next_unroller)
                     return const(v)
         w_item = frame.do_operation("next", w_iter)
-        frame.handle_implicit_exceptions([StopIteration, RuntimeError])
+        frame.guessexception([StopIteration, RuntimeError])
         return w_item
 
 
@@ -365,10 +365,10 @@
                                types.TypeType)) and
                   c.__module__ in ['__builtin__', 'exceptions']):
                 if c in builtins_exceptions:
-                    
self.frame.handle_implicit_exceptions(builtins_exceptions[c])
+                    self.frame.guessexception(builtins_exceptions[c])
                 return w_res
         # *any* exception for non-builtins
-        self.frame.handle_implicit_exceptions([Exception])
+        self.frame.guessexception([Exception])
         return w_res
 
     def find_global(self, w_globals, varname):
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to