Commits

Tyler Wade committed a000ef4

Make -O set __debug__ to False and change JUMP_IF_NOT_DEBUG to a relative jump

  • Participants
  • Parent commits 6deea9f

Comments (0)

Files changed (3)

lib-python/2.7/opcode.py

 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

pypy/bin/pyinteractive.py

                   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

pypy/interpreter/app_main.py

         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")