make gdb skip expected
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 subprocess
 import imp
 import time
+import sysconfig
+
+
 try:
     import _thread
 except ImportError:
@@ -885,6 +888,16 @@
     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.