[pypy-svn] r15283 - in pypy/dist/pypy: interpreter objspace/std
hpk at codespeak.net
hpk at codespeak.net
Thu Jul 28 19:49:11 CEST 2005
Author: hpk
Date: Thu Jul 28 19:49:10 2005
New Revision: 15283
Modified:
pypy/dist/pypy/interpreter/baseobjspace.py
pypy/dist/pypy/objspace/std/objspace.py
Log:
untangle initialization regarding options for
object spaces a bit.
however, since some time '--oldstyle' does
not seem to work correctly (with or without
this change)
Modified: pypy/dist/pypy/interpreter/baseobjspace.py
==============================================================================
--- pypy/dist/pypy/interpreter/baseobjspace.py (original)
+++ pypy/dist/pypy/interpreter/baseobjspace.py Thu Jul 28 19:49:10 2005
@@ -107,7 +107,9 @@
nofaking=False,
uselibfile=False,
parser="recparser",
- compiler="pyparse"):
+ compiler="pyparse",
+ **kw
+ ):
"NOT_RPYTHON: Basic initialization of objects."
self.fromcache = InternalSpaceCache(self).getorbuild
self.threadlocals = ThreadLocals()
@@ -119,8 +121,14 @@
self.options.uselibfile = uselibfile or nofaking
self.options.compiler = compiler
self.options.usemodules = usemodules
+ if kw:
+ self.setoptions(kw)
self.initialize()
+ def setoptions(self, kw):
+ # override this in subclasses for extra-options
+ raise TypeError("got unknown keyword arguments: %r" %(kw,))
+
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 19:49:10 2005
@@ -29,11 +29,12 @@
PACKAGE_PATH = 'objspace.std'
- def __init__(self, oldstyle=False, **kw):
- super(StdObjSpace, self).__init__(**kw)
- self.options.oldstyle = oldstyle
- if oldstyle:
- self.enable_old_style_classes_as_default_metaclass()
+ 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 initialize(self):
"NOT_RPYTHON: only for initializing the space."
@@ -111,6 +112,9 @@
self.default_compiler = PythonCompilerApp(self)
self.getexecutioncontext().compiler = self.default_compiler
+ if self.options.oldstyle:
+ self.enable_old_style_classes_as_default_metaclass()
+
def enable_old_style_classes_as_default_metaclass(self):
self.setitem(self.builtin.w_dict, self.wrap('__metaclass__'), self.w_classobj)
More information about the Pypy-commit
mailing list