[pypy-svn] r15538 - in pypy/dist/pypy: interpreter module/_sre module/marshal module/marshal/test objspace/std translator/goal

hpk at codespeak.net hpk at codespeak.net
Wed Aug 3 09:54:23 CEST 2005


Author: hpk
Date: Wed Aug  3 09:54:21 2005
New Revision: 15538

Modified:
   pypy/dist/pypy/interpreter/baseobjspace.py
   pypy/dist/pypy/module/_sre/   (props changed)
   pypy/dist/pypy/module/marshal/   (props changed)
   pypy/dist/pypy/module/marshal/test/   (props changed)
   pypy/dist/pypy/module/marshal/test/test_marshal.py
   pypy/dist/pypy/objspace/std/model.py
   pypy/dist/pypy/translator/goal/targetpypymain.py
Log:
make the trunk translateable again + FIXEOL 

- marshal and _sre are now switched off by default
  and also don't get translated. You can use 
  --usemodules=_sre or --usemodules=marshal or 
  --usemodules=marshal,_sre 
  for usage on pypy/cpython

- don't import marshal multimethod in the
  objspace/std/model.py.  We need to investigate
  what causes the 5 MM-related RTyper errors 
  if you include it. 

- added some more comments and clarifications 
  here and there



Modified: pypy/dist/pypy/interpreter/baseobjspace.py
==============================================================================
--- pypy/dist/pypy/interpreter/baseobjspace.py	(original)
+++ pypy/dist/pypy/interpreter/baseobjspace.py	Wed Aug  3 09:54:21 2005
@@ -160,19 +160,26 @@
         except AttributeError:
             pass
 
-        l = ['sys', '__builtin__', 'exceptions', 'unicodedata', '_codecs', 'marshal',
-             '_sre']
+        modules = ['sys', '__builtin__', 'exceptions', 'unicodedata', '_codecs']
 
         if self.options.nofaking:
-            l.append('posix')
-            l.append('math')
-            l.append('time')
-
+            modules.append('posix')
+            modules.append('math')
+            modules.append('time')
+
+        # there also are the '_sre' and 'marshal' modules 
+        # but those currently cause translation problems.  You can
+        # enable them when running PyPy on top of CPython 
+        # by e.g. specifying --usemodules=_sre,marshal 
         for name in self.options.usemodules: 
-            if name not in l: 
-                l.append(name) 
+            if name not in modules: 
+                modules.append(name) 
 
-        builtinmodule_list = [(x, None) for x in l]
+        # the returned builtinmodule_list contains tuples of
+        # names because some modules have a filesystem name 
+        # that differs from the app-visible name (because you 
+        # can specify implementation variants)
+        builtinmodule_list = [(x, None) for x in modules]
         if self.options.parser == "recparser":
             builtinmodule_list.append(('parser', 'recparser'))
             builtinmodule_list.append(('symbol', None))

Modified: pypy/dist/pypy/module/marshal/test/test_marshal.py
==============================================================================
--- pypy/dist/pypy/module/marshal/test/test_marshal.py	(original)
+++ pypy/dist/pypy/module/marshal/test/test_marshal.py	Wed Aug  3 09:54:21 2005
@@ -1,4 +1,8 @@
+
 class AppTestMarshal:
+    def setup_class(cls): 
+        from pypy.objspace.std import StdObjSpace 
+        cls.space = StdObjSpace(usemodules=["marshal"])
 
     def test_None(self):
         import sys

Modified: pypy/dist/pypy/objspace/std/model.py
==============================================================================
--- pypy/dist/pypy/objspace/std/model.py	(original)
+++ pypy/dist/pypy/objspace/std/model.py	Wed Aug  3 09:54:21 2005
@@ -53,7 +53,9 @@
         from pypy.objspace.std import dictproxyobject
         from pypy.objspace.std import fake
         import pypy.objspace.std.default # register a few catch-all multimethods
-        import pypy.objspace.std.marshal_impl # install marshal multimethods
+        # XXX the following line causes 5 RTyper errors
+        #     related to the marshal multimethod
+        #import pypy.objspace.std.marshal_impl # install marshal multimethods
 
         # the set of implementation types
         self.typeorder = {

Modified: pypy/dist/pypy/translator/goal/targetpypymain.py
==============================================================================
--- pypy/dist/pypy/translator/goal/targetpypymain.py	(original)
+++ pypy/dist/pypy/translator/goal/targetpypymain.py	Wed Aug  3 09:54:21 2005
@@ -57,6 +57,7 @@
     space = StdObjSpace(nofaking=True,
                         compiler="pyparseapp",
                         translating=True,
+                        #usemodules=['marhsal', '_sre'],
                         geninterp=False)
 
     # manually imports app_main.py



More information about the Pypy-commit mailing list