From 6801cde2b780a175c7f875b24f6747696e0ca7b3 Mon Sep 17 00:00:00 2001 From: Alexander Schremmer Date: Wed, 26 Sep 2007 11:42:02 +0000 Subject: Move the oldstyle translation option to py.py and app_main.py to make it setable at runtime. --- pypy/bin/py.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'pypy/bin') diff --git a/pypy/bin/py.py b/pypy/bin/py.py index 848e057184..c396a2705f 100755 --- a/pypy/bin/py.py +++ b/pypy/bin/py.py @@ -37,6 +37,9 @@ cmdline_optiondescr = OptionDescription("interactive", "the options of py.py", [ StrOption("runcommand", "program passed in as CMD (terminates option list)", default=None, cmdline="-c"), + BoolOption("oldstyle_classes", + "Use old-style classes by default.", + default=False, cmdline="-k --oldstyle"), ]) pypy_init = gateway.applevel(''' @@ -73,11 +76,9 @@ def main_(argv=None): space = option.make_objspace(config) space._starttime = starttime - #assert 'pypy.tool.udir' not in sys.modules, ( - # "running py.py should not import pypy.tool.udir, which is\n" - # "only for testing or translating purposes.") - # ^^^ _socket and other rctypes-based modules need udir - space.setitem(space.sys.w_dict,space.wrap('executable'),space.wrap(argv[0])) + space.setitem(space.sys.w_dict, space.wrap('executable'), space.wrap(argv[0])) + if interactiveconfig.oldstyle_classes: + space.setitem(space.builtin.w_dict, space.wrap('__metaclass__'), space.w_classobj) # store the command-line arguments into sys.argv go_interactive = interactiveconfig.interactive -- cgit v1.2.3-65-gdbad