[pypy-svn] r15285 - in pypy/dist/pypy: interpreter objspace/std

arigo at codespeak.net arigo at codespeak.net
Thu Jul 28 20:46:01 CEST 2005


Author: arigo
Date: Thu Jul 28 20:45:57 2005
New Revision: 15285

Modified:
   pypy/dist/pypy/interpreter/baseobjspace.py
   pypy/dist/pypy/objspace/std/objspace.py
Log:
Changed the space.setoptions() interface to pass options by keyword again.
This avoids a problem where the attribute 'space.options.oldstyle' is not set
at all (instead of getting a default of False) if the space is built without
specifying an 'oldstyle' keyword.



Modified: pypy/dist/pypy/interpreter/baseobjspace.py
==============================================================================
--- pypy/dist/pypy/interpreter/baseobjspace.py	(original)
+++ pypy/dist/pypy/interpreter/baseobjspace.py	Thu Jul 28 20:45:57 2005
@@ -121,13 +121,12 @@
         self.options.uselibfile = uselibfile or nofaking
         self.options.compiler = compiler 
         self.options.usemodules = usemodules 
-        if kw: 
-            self.setoptions(kw)
+        self.setoptions(**kw)
         self.initialize()
 
-    def setoptions(self, kw): 
+    def setoptions(self):
         # override this in subclasses for extra-options
-        raise TypeError("got unknown keyword arguments: %r" %(kw,))
+        pass
 
     def __repr__(self):
         return self.__class__.__name__

Modified: pypy/dist/pypy/objspace/std/objspace.py
==============================================================================
--- pypy/dist/pypy/objspace/std/objspace.py	(original)
+++ pypy/dist/pypy/objspace/std/objspace.py	Thu Jul 28 20:45:57 2005
@@ -29,12 +29,8 @@
 
     PACKAGE_PATH = 'objspace.std'
 
-    def setoptions(self, kw): 
-        optionlist = 'oldstyle'.split()
-        for name in kw: 
-            if name not in optionlist: 
-                raise TypeError("don't know about option %r" % (name,))
-            setattr(self.options, name, kw[name])
+    def setoptions(self, oldstyle=False):
+        self.options.oldstyle = oldstyle
 
     def initialize(self):
         "NOT_RPYTHON: only for initializing the space."



More information about the Pypy-commit mailing list