[pypy-commit] pypy less-stringly-ops: Simplify FlowObjSpace.import_from()

rlamy noreply at buildbot.pypy.org
Tue Sep 24 05:08:56 CEST 2013


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: less-stringly-ops
Changeset: r67077:472c03f496f5
Date: 2013-09-24 04:08 +0100
http://bitbucket.org/pypy/pypy/changeset/472c03f496f5/

Log:	Simplify FlowObjSpace.import_from()

diff --git a/rpython/flowspace/objspace.py b/rpython/flowspace/objspace.py
--- a/rpython/flowspace/objspace.py
+++ b/rpython/flowspace/objspace.py
@@ -158,14 +158,9 @@
     def import_from(self, w_module, w_name):
         assert isinstance(w_module, Constant)
         assert isinstance(w_name, Constant)
-        # handle sys
-        if w_module in NOT_REALLY_CONST:
-            const_w = NOT_REALLY_CONST[w_module]
-            if w_name not in const_w:
-                return self.frame.do_op(op.getattr(w_module, w_name))
         try:
-            return const(getattr(w_module.value, w_name.value))
-        except AttributeError:
+            return self.getattr(w_module, w_name)
+        except FlowingError:
             exc = ImportError("cannot import name '%s'" % w_name.value)
             raise Raise(const(exc))
 


More information about the pypy-commit mailing list