[pypy-commit] pypy less-stringly-ops: Extract helper from FlowObjSpace.call_args()

rlamy noreply at buildbot.pypy.org
Sun Sep 22 21:24:52 CEST 2013


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: less-stringly-ops
Changeset: r67060:09873ad29c60
Date: 2013-09-22 07:35 +0100
http://bitbucket.org/pypy/pypy/changeset/09873ad29c60/

Log:	Extract helper from FlowObjSpace.call_args()

diff --git a/rpython/flowspace/objspace.py b/rpython/flowspace/objspace.py
--- a/rpython/flowspace/objspace.py
+++ b/rpython/flowspace/objspace.py
@@ -246,7 +246,10 @@
             else:
                 args_w = args.arguments_w
             w_res = self.frame.do_operation('simple_call', w_callable, *args_w)
+        self.frame.guessexception(self._callable_exceptions(w_callable))
+        return w_res
 
+    def _callable_exceptions(self, w_callable):
         if isinstance(w_callable, Constant):
             c = w_callable.value
             if (isinstance(c, (types.BuiltinFunctionType,
@@ -254,12 +257,10 @@
                                types.ClassType,
                                types.TypeType)) and
                   c.__module__ in ['__builtin__', 'exceptions']):
-                if c in builtins_exceptions:
-                    self.frame.guessexception(builtins_exceptions[c])
-                return w_res
+                return builtins_exceptions.get(c, [])
         # *any* exception for non-builtins
-        self.frame.guessexception([Exception])
-        return w_res
+        return [Exception]
+
 
     def find_global(self, w_globals, varname):
         try:


More information about the pypy-commit mailing list