summaryrefslogtreecommitdiffstats
path: root/Lib/test/support.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2010-10-29 21:31:35 (GMT)
committerBenjamin Peterson <benjamin@python.org>2010-10-29 21:31:35 (GMT)
commit65c66ab2559256b5b3a1e2dd8ef9679121e3de64 (patch)
treed469b2c08a57d476852c48205962f62ad78ce8db /Lib/test/support.py
parent9f5db07dab9a2f7f82e6e2763bfdb866ee0c1be3 (diff)
downloadcpython-65c66ab2559256b5b3a1e2dd8ef9679121e3de64.zip
cpython-65c66ab2559256b5b3a1e2dd8ef9679121e3de64.tar.gz
cpython-65c66ab2559256b5b3a1e2dd8ef9679121e3de64.tar.bz2
make gdb skip expected
Diffstat (limited to 'Lib/test/support.py')
-rw-r--r--Lib/test/support.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/support.py b/Lib/test/support.py
index 31528a9..132bc56 100644
--- a/Lib/test/support.py
+++ b/Lib/test/support.py
@@ -20,6 +20,9 @@ import re
import subprocess
import imp
import time
+import sysconfig
+
+
try:
import _thread
except ImportError:
@@ -885,6 +888,16 @@ def gc_collect():
gc.collect()
+def python_is_optimized():
+ """Find if Python was built with optimizations."""
+ cflags = sysconfig.get_config_vars()['PY_CFLAGS']
+ final_opt = ""
+ for opt in cflags.split():
+ if opt.startswith('-O'):
+ final_opt = opt
+ return final_opt and final_opt != '-O0'
+
+
#=======================================================================
# Decorator for running a function in a different locale, correctly resetting
# it afterwards.