aboutsummaryrefslogtreecommitdiff
path: root/pypy/bin
diff options
context:
space:
mode:
authorTyler Wade <wayedt@gmail.com>2013-04-26 17:31:43 -0500
committerTyler Wade <wayedt@gmail.com>2013-04-26 17:31:43 -0500
commit3fdd88417b8bc374f48c2b26bb4fa5266dcabf4a (patch)
tree2df224e2e196b677741e4402ea13e786c34dd3c4 /pypy/bin
parentFix tests when run with -A: CPython folds constants differently. (diff)
downloadpypy-3fdd88417b8bc374f48c2b26bb4fa5266dcabf4a.tar.gz
pypy-3fdd88417b8bc374f48c2b26bb4fa5266dcabf4a.tar.bz2
pypy-3fdd88417b8bc374f48c2b26bb4fa5266dcabf4a.zip
Add support for -OO flag
Diffstat (limited to 'pypy/bin')
-rwxr-xr-xpypy/bin/pyinteractive.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/pypy/bin/pyinteractive.py b/pypy/bin/pyinteractive.py
index 0b980d4a09..802d720477 100755
--- a/pypy/bin/pyinteractive.py
+++ b/pypy/bin/pyinteractive.py
@@ -27,7 +27,7 @@ cmdline_optiondescr = OptionDescription("interactive", "the options of pyinterac
BoolOption("completer", "use readline commandline completer",
default=False, cmdline="-C"),
BoolOption("optimize",
- "dummy optimization flag for compatibility with CPython",
+ "remove docstrings when importing modules (like CPython -OO)",
default=False, cmdline="-O"),
BoolOption("no_site_import", "do not 'import site' on initialization",
default=False, cmdline="-S"),
@@ -90,6 +90,14 @@ def main_(argv=None):
space = option.make_objspace(config)
+ if interactiveconfig.optimize:
+ flags = space.sys.get('flags').getitems_copy()
+ #change optimize flag's value
+ flags[6] = space.wrap(2)
+ flags = type(space.sys.get('flags'))(flags)
+ flags.user_setup(space, space.sys.get('flags').w__class__)
+ space.sys.w_dict.setitem(space.wrap('flags'), flags)
+
space._starttime = starttime
space.setitem(space.sys.w_dict, space.wrap('executable'),
space.wrap(argv[0]))