Author: Tyler Wade <[email protected]>
Branch:
Changeset: r64753:a000ef4ae952
Date: 2013-04-29 00:57 -0500
http://bitbucket.org/pypy/pypy/changeset/a000ef4ae952/
Log: Make -O set __debug__ to False and change JUMP_IF_NOT_DEBUG to a
relative jump
diff --git a/lib-python/2.7/opcode.py b/lib-python/2.7/opcode.py
--- a/lib-python/2.7/opcode.py
+++ b/lib-python/2.7/opcode.py
@@ -193,6 +193,6 @@
hasname.append(201)
def_op('CALL_METHOD', 202) # #args not including 'self'
def_op('BUILD_LIST_FROM_ARG', 203)
-jabs_op('JUMP_IF_NOT_DEBUG', 204) # Target address
+jrel_op('JUMP_IF_NOT_DEBUG', 204) # Target address
del def_op, name_op, jrel_op, jabs_op
diff --git a/pypy/bin/pyinteractive.py b/pypy/bin/pyinteractive.py
--- a/pypy/bin/pyinteractive.py
+++ b/pypy/bin/pyinteractive.py
@@ -95,12 +95,14 @@
space.wrap(argv[0]))
if interactiveconfig.optimize:
- #change the optimize flag's value
+ #change the optimize flag's value and set __debug__ to False
space.appexec([], """():
import sys
flags = list(sys.flags)
flags[6] = 2
sys.flags = type(sys.flags)(flags)
+ import __builtin__
+ setattr(__builtin__, '__debug__', False)
""")
# call pypy_find_stdlib: the side-effect is that it sets sys.prefix and
diff --git a/pypy/interpreter/app_main.py b/pypy/interpreter/app_main.py
--- a/pypy/interpreter/app_main.py
+++ b/pypy/interpreter/app_main.py
@@ -450,6 +450,10 @@
sys.py3kwarning = bool(sys.flags.py3k_warning)
sys.dont_write_bytecode = bool(sys.flags.dont_write_bytecode)
+ if sys.flags.optimize >= 1:
+ import __builtin__
+ setattr(__builtin__, '__debug__', False)
+
if sys.py3kwarning:
print >> sys.stderr, (
"Warning: pypy does not implement py3k warnings")
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit