[pypy-svn] r39751 - pypy/branch/rope-branch/pypy/objspace/std

cfbolz at codespeak.net cfbolz at codespeak.net
Fri Mar 2 21:02:48 CET 2007


Author: cfbolz
Date: Fri Mar  2 21:02:47 2007
New Revision: 39751

Modified:
   pypy/branch/rope-branch/pypy/objspace/std/model.py
   pypy/branch/rope-branch/pypy/objspace/std/objspace.py
Log:
obscure, obscure: magically import those classes not in the typeorder too


Modified: pypy/branch/rope-branch/pypy/objspace/std/model.py
==============================================================================
--- pypy/branch/rope-branch/pypy/objspace/std/model.py	(original)
+++ pypy/branch/rope-branch/pypy/objspace/std/model.py	Fri Mar  2 21:02:47 2007
@@ -114,7 +114,7 @@
         self.typeorder[setobject.W_FrozensetObject] = []
         self.typeorder[setobject.W_SetIterObject] = []
 
-        imported_but_not_registered = {
+        self.imported_but_not_registered = {
             dictobject.W_DictObject: True,
             dictobject.W_DictIterObject: True,
             listobject.W_ListObject: True,
@@ -127,7 +127,7 @@
                     if value:
                         self.typeorder[implcls] = []
                     else:
-                        imported_but_not_registered[implcls] = True
+                        self.imported_but_not_registered[implcls] = True
 
         if (config.objspace.std.withstrdict or
             config.objspace.std.withmultidict):
@@ -143,7 +143,7 @@
         from pypy.objspace.std.objspace import _registered_implementations
         for implcls in _registered_implementations:
             assert (implcls in self.typeorder or
-                    implcls in imported_but_not_registered), (
+                    implcls in self.imported_but_not_registered), (
                 "please add %r in StdTypeModel.typeorder" % (implcls,))
 
 

Modified: pypy/branch/rope-branch/pypy/objspace/std/objspace.py
==============================================================================
--- pypy/branch/rope-branch/pypy/objspace/std/objspace.py	(original)
+++ pypy/branch/rope-branch/pypy/objspace/std/objspace.py	Fri Mar  2 21:02:47 2007
@@ -155,6 +155,8 @@
         # hack to avoid imports in the time-critical functions below
         for cls in self.model.typeorder:
             globals()[cls.__name__] = cls
+        for cls in self.model.imported_but_not_registered:
+            globals()[cls.__name__] = cls
 
         # singletons
         self.w_None  = W_NoneObject()



More information about the Pypy-commit mailing list