[pypy-svn] r18897 - in pypy/dist/pypy: interpreter module/thread translator translator/goal

pedronis at codespeak.net pedronis at codespeak.net
Mon Oct 24 22:37:14 CEST 2005


Author: pedronis
Date: Mon Oct 24 22:37:12 2005
New Revision: 18897

Modified:
   pypy/dist/pypy/interpreter/baseobjspace.py
   pypy/dist/pypy/module/thread/os_local.py
   pypy/dist/pypy/translator/ann_override.py
   pypy/dist/pypy/translator/goal/targetpypystandalone.py
Log:
* use space.type consistently (so that it could possibly be overriden at annotation time)

* let PyPy policy take a space to signal that we translate for the single space case



Modified: pypy/dist/pypy/interpreter/baseobjspace.py
==============================================================================
--- pypy/dist/pypy/interpreter/baseobjspace.py	(original)
+++ pypy/dist/pypy/interpreter/baseobjspace.py	Mon Oct 24 22:37:12 2005
@@ -29,6 +29,7 @@
                              space.wrap("attribute '__dict__' of %s objects "
                                         "is not writable" % typename))
 
+    # to be used directly only by space.type implementations
     def getclass(self, space):
         return space.gettypeobject(self.typedef)
 

Modified: pypy/dist/pypy/module/thread/os_local.py
==============================================================================
--- pypy/dist/pypy/module/thread/os_local.py	(original)
+++ pypy/dist/pypy/module/thread/os_local.py	Mon Oct 24 22:37:12 2005
@@ -32,7 +32,7 @@
             # call __init__
             try:
                 w_self = space.wrap(self)
-                w_type = self.getclass(space)
+                w_type = space.type(w_self)
                 w_init = space.getattr(w_type, space.wrap("__init__"))
                 space.call_args(w_init, self.initargs.prepend(w_self))
             except:

Modified: pypy/dist/pypy/translator/ann_override.py
==============================================================================
--- pypy/dist/pypy/translator/ann_override.py	(original)
+++ pypy/dist/pypy/translator/ann_override.py	Mon Oct 24 22:37:12 2005
@@ -9,10 +9,11 @@
 class PyPyAnnotatorPolicy(AnnotatorPolicy):
     allow_someobjects = False
 
-    def __init__(pol):
+    def __init__(pol, single_space=None):
         pol.lookups = {}
         pol.lookups_where = {}
         pol.pypytypes = {}
+        pol.single_space = single_space
 
     def override__wrap_exception_cls(pol, space, x):
         import pypy.objspace.std.typeobject as typeobject
@@ -125,7 +126,7 @@
 
 CACHED_LOOKUP = """
 def lookup_%(attr)s(space, w_obj, name):
-    w_type = w_obj.getclass(space)
+    w_type = space.type(w_obj)
     if not w_type.is_heaptype():
         return w_type.cached_%(attr)s
     return w_type.lookup("%(attr)s")

Modified: pypy/dist/pypy/translator/goal/targetpypystandalone.py
==============================================================================
--- pypy/dist/pypy/translator/goal/targetpypystandalone.py	(original)
+++ pypy/dist/pypy/translator/goal/targetpypystandalone.py	Mon Oct 24 22:37:12 2005
@@ -79,5 +79,5 @@
     res = entry_point(["pypy", "app_basic_example.py"])
     assert res == 0
 
-    return entry_point, None, PyPyAnnotatorPolicy()
+    return entry_point, None, PyPyAnnotatorPolicy(single_space = space)
 



More information about the Pypy-commit mailing list