[pypy-svn] r46529 - in pypy/dist/pypy: interpreter module/_weakref translator/goal

arigo at codespeak.net arigo at codespeak.net
Thu Sep 13 10:43:54 CEST 2007


Author: arigo
Date: Thu Sep 13 10:43:53 2007
New Revision: 46529

Modified:
   pypy/dist/pypy/interpreter/baseobjspace.py
   pypy/dist/pypy/interpreter/mixedmodule.py
   pypy/dist/pypy/module/_weakref/__init__.py
   pypy/dist/pypy/translator/goal/targetpypystandalone.py
Log:
Revert the SkipModule logic introduced in r46443.  Instead, let's use
the same style as already present in targetpypystandalone, which has the
advantage of detecting inconsistent option combinations like
--gc=ref --withmod-_weakref.


Modified: pypy/dist/pypy/interpreter/baseobjspace.py
==============================================================================
--- pypy/dist/pypy/interpreter/baseobjspace.py	(original)
+++ pypy/dist/pypy/interpreter/baseobjspace.py	Thu Sep 13 10:43:53 2007
@@ -246,7 +246,6 @@
     def setbuiltinmodule(self, importname):
         """NOT_RPYTHON. load a lazy pypy/module and put it into sys.modules"""
         import sys
-        from pypy.interpreter.mixedmodule import SkipModule
 
         fullname = "pypy.module.%s" % importname
 
@@ -258,10 +257,7 @@
             name = importname
 
         w_name = self.wrap(name)
-        try:
-            w_mod = self.wrap(Module(self, w_name))
-        except SkipModule:
-            return None
+        w_mod = self.wrap(Module(self, w_name))
         w_modules = self.sys.get('modules')
         self.setitem(w_modules, w_name, w_mod)
         return name

Modified: pypy/dist/pypy/interpreter/mixedmodule.py
==============================================================================
--- pypy/dist/pypy/interpreter/mixedmodule.py	(original)
+++ pypy/dist/pypy/interpreter/mixedmodule.py	Thu Sep 13 10:43:53 2007
@@ -7,9 +7,6 @@
 
 import inspect
 
-class SkipModule(Exception):
-    """Skip the installation of this built-in module."""
-
 class MixedModule(Module):
 
     NOT_RPYTHON_ATTRIBUTES = ['loaders']

Modified: pypy/dist/pypy/module/_weakref/__init__.py
==============================================================================
--- pypy/dist/pypy/module/_weakref/__init__.py	(original)
+++ pypy/dist/pypy/module/_weakref/__init__.py	Thu Sep 13 10:43:53 2007
@@ -1,4 +1,4 @@
-from pypy.interpreter.mixedmodule import MixedModule, SkipModule
+from pypy.interpreter.mixedmodule import MixedModule
     
 class Module(MixedModule):
     appleveldefs = {
@@ -12,8 +12,3 @@
         'CallableProxyType': 'interp__weakref.W_CallableProxy',
         'proxy': 'interp__weakref.proxy'
     }
-
-    def __init__(self, space, *args):
-        if not space.config.translation.rweakref:
-            raise SkipModule("no RPython-level weakrefs")
-        MixedModule.__init__(self, space, *args)

Modified: pypy/dist/pypy/translator/goal/targetpypystandalone.py
==============================================================================
--- pypy/dist/pypy/translator/goal/targetpypystandalone.py	(original)
+++ pypy/dist/pypy/translator/goal/targetpypystandalone.py	Thu Sep 13 10:43:53 2007
@@ -134,6 +134,9 @@
         elif config.objspace.usemodules._stackless:
             config.translation.stackless = True
 
+        if not config.translation.rweakref:
+            config.objspace.usemodules._weakref = False
+
         if self.translateconfig.goal_options.jit:
             config.objspace.usemodules.pypyjit = True
         elif config.objspace.usemodules.pypyjit:



More information about the Pypy-commit mailing list