[pypy-commit] pypy annotator: move import_from() out of FlowObjSpace

rlamy noreply at buildbot.pypy.org
Fri Jan 17 18:36:49 CET 2014


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: annotator
Changeset: r68742:f797aeca8026
Date: 2014-01-17 01:22 +0000
http://bitbucket.org/pypy/pypy/changeset/f797aeca8026/

Log:	move import_from() out of FlowObjSpace

diff --git a/rpython/flowspace/flowcontext.py b/rpython/flowspace/flowcontext.py
--- a/rpython/flowspace/flowcontext.py
+++ b/rpython/flowspace/flowcontext.py
@@ -717,10 +717,19 @@
         w_obj = self.import_name(modulename, glob, None, fromlist, level)
         self.pushvalue(w_obj)
 
+    def import_from(self, w_module, w_name):
+        assert isinstance(w_module, Constant)
+        assert isinstance(w_name, Constant)
+        try:
+            return op.getattr(w_module, w_name).eval(self)
+        except FlowingError:
+            exc = ImportError("cannot import name '%s'" % w_name.value)
+            raise Raise(const(exc))
+
     def IMPORT_FROM(self, nameindex):
         w_name = self.getname_w(nameindex)
         w_module = self.peekvalue()
-        self.pushvalue(self.space.import_from(w_module, w_name))
+        self.pushvalue(self.import_from(w_module, w_name))
 
     def RETURN_VALUE(self, oparg):
         w_returnvalue = self.popvalue()
diff --git a/rpython/flowspace/objspace.py b/rpython/flowspace/objspace.py
--- a/rpython/flowspace/objspace.py
+++ b/rpython/flowspace/objspace.py
@@ -38,15 +38,6 @@
     def build_flow(self, func):
         return build_flow(func, self)
 
-    def import_from(self, w_module, w_name):
-        assert isinstance(w_module, Constant)
-        assert isinstance(w_name, Constant)
-        try:
-            return op.getattr(w_module, w_name).eval(self.frame)
-        except FlowingError:
-            exc = ImportError("cannot import name '%s'" % w_name.value)
-            raise Raise(const(exc))
-
     def call_method(self, w_obj, methname, *arg_w):
         w_meth = op.getattr(w_obj, const(methname)).eval(self.frame)
         return self.call_function(w_meth, *arg_w)


More information about the pypy-commit mailing list