Commit a6332d43 authored by Stefan Behnel's avatar Stefan Behnel

Py2.5 test fix

parent 2776eeb8
......@@ -20,10 +20,16 @@ else:
DBG = False
import sys
if DBG == sys.flags.optimize:
try:
optimised = bool(sys.flags.optimize)
except AttributeError:
# Py2.[45]
optimised = eval('not __debug__')
if DBG == optimised:
raise RuntimeError(
"PYTHON: unexpected debug value %s, expected %s" % (
DBG, sys.flags.optimize))
DBG, optimised))
ASSERT_CALLED = False
def sideeffect():
......@@ -32,14 +38,14 @@ def sideeffect():
return True
assert sideeffect()
if ASSERT_CALLED and sys.flags.optimize:
if ASSERT_CALLED == optimised:
raise RuntimeError("Assert called in optimised Python run")
import debug_test_cython
if debug_test_cython.DBG == sys.flags.optimize:
if debug_test_cython.DBG == optimised:
raise RuntimeError(
"CYTHON: unexpected debug value %s, expected %s" % (
debug_test_cython.DBG, sys.flags.optimize))
debug_test_cython.DBG, optimised))
######## debug_test_cython.pyx ########
......@@ -49,17 +55,23 @@ if __debug__:
else:
DBG = False
import sys
try:
optimised = bool(sys.flags.optimize)
except AttributeError:
# Py2.[45]
optimised = eval('not __debug__')
ASSERT_CALLED = False
def sideeffect():
global ASSERT_CALLED
ASSERT_CALLED = True
return True
import sys
if DBG == sys.flags.optimize:
if DBG == optimised:
raise RuntimeError("Unexpected debug value %s, expected %s" % (
DBG, sys.flags.optimize))
DBG, optimised))
assert sideeffect()
if ASSERT_CALLED and sys.flags.optimize:
if ASSERT_CALLED == optimised:
raise RuntimeError("Assert called in optimised Python run")
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment