[pypy-commit] pypy translation-cleanup: Remove now unused attribute HostCode.space

rlamy noreply at buildbot.pypy.org
Fri Oct 5 01:33:05 CEST 2012


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: translation-cleanup
Changeset: r57791:baf75ba3392b
Date: 2012-10-05 00:20 +0100
http://bitbucket.org/pypy/pypy/changeset/baf75ba3392b/

Log:	Remove now unused attribute HostCode.space

diff --git a/pypy/objspace/flow/bytecode.py b/pypy/objspace/flow/bytecode.py
--- a/pypy/objspace/flow/bytecode.py
+++ b/pypy/objspace/flow/bytecode.py
@@ -17,12 +17,11 @@
     """
     opnames = host_bytecode_spec.method_names
 
-    def __init__(self, space,  argcount, nlocals, stacksize, flags,
+    def __init__(self, argcount, nlocals, stacksize, flags,
                      code, consts, names, varnames, filename,
                      name, firstlineno, lnotab, freevars, cellvars,
                      hidden_applevel=False, magic=cpython_magic):
         """Initialize a new code object"""
-        self.space = space
         self.co_name = name
         assert nlocals >= 0
         self.co_argcount = argcount
@@ -69,17 +68,17 @@
                         self._args_as_cellvars[i] = j
 
     @classmethod
-    def _from_code(cls, space, code, hidden_applevel=False):
+    def _from_code(cls, code, hidden_applevel=False):
         """Initialize the code object from a real (CPython) one.
         """
         newconsts = []
         for const in code.co_consts:
             if isinstance(const, CodeType):
-                const = cls._from_code(space, const, hidden_applevel)
+                const = cls._from_code(const, hidden_applevel)
             newconsts.append(const)
         # stick the underlying CPython magic value, if the code object
         # comes from there
-        return cls(space, code.co_argcount,
+        return cls(code.co_argcount,
                       code.co_nlocals,
                       code.co_stacksize,
                       code.co_flags,
diff --git a/pypy/objspace/flow/objspace.py b/pypy/objspace/flow/objspace.py
--- a/pypy/objspace/flow/objspace.py
+++ b/pypy/objspace/flow/objspace.py
@@ -239,7 +239,7 @@
         """
         if func.func_doc and func.func_doc.lstrip().startswith('NOT_RPYTHON'):
             raise Exception, "%r is tagged as NOT_RPYTHON" % (func,)
-        code = HostCode._from_code(self, func.func_code)
+        code = HostCode._from_code(func.func_code)
         if (code.is_generator and
                 not hasattr(func, '_generator_next_method_of_')):
             graph = PyGraph(func, code)
diff --git a/pypy/objspace/flow/test/test_framestate.py b/pypy/objspace/flow/test/test_framestate.py
--- a/pypy/objspace/flow/test/test_framestate.py
+++ b/pypy/objspace/flow/test/test_framestate.py
@@ -14,7 +14,7 @@
             func = func.im_func
         except AttributeError:
             pass
-        code = HostCode._from_code(self.space, func.func_code)
+        code = HostCode._from_code(func.func_code)
         graph = PyGraph(func, code)
         frame = FlowSpaceFrame(self.space, graph, code)
         # hack the frame


More information about the pypy-commit mailing list