[pypy-svn] r9060 - in pypy/dist/pypy: . objspace/std tool
pedronis at codespeak.net
pedronis at codespeak.net
Thu Feb 10 19:51:40 CET 2005
Author: pedronis
Date: Thu Feb 10 19:51:40 2005
New Revision: 9060
Modified:
pypy/dist/pypy/conftest.py
pypy/dist/pypy/objspace/std/objspace.py
pypy/dist/pypy/tool/option.py
Log:
Aadded --oldstyle option tp py.py and tests to enable to run with old-style classes as the default
most of our own tests passes with --oldstyle but seqiter in _classobj needs to be changed from being
a generator to survive geninterplevel!
Modified: pypy/dist/pypy/conftest.py
==============================================================================
--- pypy/dist/pypy/conftest.py (original)
+++ pypy/dist/pypy/conftest.py Thu Feb 10 19:51:40 2005
@@ -11,7 +11,9 @@
options = ('pypy options', [
Option('-o', '--objspace', action="store", default=None,
type="string", dest="objspacename",
- help="object space to run tests on."),
+ help="object space to run tests on."),
+ Option('--oldstyle', action="store_true",dest="oldstyle", default=False,
+ help="enable oldstyle classes as default metaclass (std objspace only)"),
])
@@ -32,6 +34,8 @@
module = __import__("pypy.objspace.%s" % name, None, None, ["Space"])
space = module.Space()
_spacecache[name] = space
+ if name == 'std' and py.test.config.option.oldstyle:
+ space.enable_old_style_classes_as_default_metaclass()
if name != 'flow': # not sensible for flow objspace case
space.setitem(space.w_builtins, space.wrap('AssertionError'),
pytestsupport.build_pytest_assertion(space))
Modified: pypy/dist/pypy/objspace/std/objspace.py
==============================================================================
--- pypy/dist/pypy/objspace/std/objspace.py (original)
+++ pypy/dist/pypy/objspace/std/objspace.py Thu Feb 10 19:51:40 2005
@@ -81,7 +81,7 @@
mod = self.setup_exceptions(for_builtins)
# old-style classes
- #self.setup_old_style_classes()
+ self.setup_old_style_classes()
# install things in the __builtin__ module
self.make_builtins(for_builtins)
@@ -89,6 +89,9 @@
w_exceptions = self.wrap(mod)
self.sys.setbuiltinmodule(w_exceptions, 'exceptions')
+ def enable_old_style_classes_as_default_metaclass(self):
+ self.setitem(self.builtin.w_dict, self.wrap('__metaclass__'), self.w_classobj)
+
def setup_old_style_classes(self):
"""NOT_RPYTHON"""
from pypy.module import classobjinterp
Modified: pypy/dist/pypy/tool/option.py
==============================================================================
--- pypy/dist/pypy/tool/option.py (original)
+++ pypy/dist/pypy/tool/option.py Thu Feb 10 19:51:40 2005
@@ -5,6 +5,7 @@
class Options:
showwarning = 0
spaces = []
+ oldstyle = 0
def run_tb_server(option, opt, value, parser):
from pypy.tool import tb_server
@@ -21,6 +22,9 @@
callback=objspace_callback, callback_args=("std",),
help="run in std object space"))
options.append(make_option(
+ '--oldstyle', action="store_true",dest="oldstyle",
+ help="enable oldstyle classes as default metaclass (std objspace only)"))
+ options.append(make_option(
'-T', action="callback",
callback=objspace_callback, callback_args=("trivial",),
help="run in trivial object space"))
@@ -60,4 +64,7 @@
except KeyError:
module = __import__("pypy.objspace.%s" % name, None, None, ["Space"])
Space = module.Space
- return _spacecache.setdefault(name, Space())
+ space = Space()
+ if name == 'std' and Options.oldstyle:
+ space.enable_old_style_classes_as_default_metaclass()
+ return _spacecache.setdefault(name, space)
More information about the Pypy-commit
mailing list