Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f48ea7c

Browse files
committed
Issue #8605: Skip test_gdb if Python is compiled with optimizations.
1 parent 247900c commit f48ea7c

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

Lib/test/test_gdb.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import sys
1010
import unittest
1111
import locale
12+
import sysconfig
1213

1314
from test.support import run_unittest, findfile
1415

@@ -664,6 +665,15 @@ def test_locals_after_up(self):
664665
r".*\na = 1\nb = 2\nc = 3\n.*")
665666

666667
def test_main():
668+
cflags = sysconfig.get_config_vars()['PY_CFLAGS']
669+
final_opt = ""
670+
for opt in cflags.split():
671+
if opt.startswith('-O'):
672+
final_opt = opt
673+
if final_opt and final_opt != '-O0':
674+
raise unittest.SkipTest("Python was built with compiler optimizations, "
675+
"tests can't reliably succeed")
676+
667677
run_unittest(PrettyPrintTests,
668678
PyListTests,
669679
StackNavigationTests,

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1614,6 +1614,8 @@ Documentation
16141614
Tests
16151615
-----
16161616

1617+
- Issue #8605: Skip test_gdb if Python is compiled with optimizations.
1618+
16171619
- Issue #7449: Skip test_socketserver if threading support is disabled
16181620

16191621
- Issue #8672: Add a zlib test ensuring that an incomplete stream can be

0 commit comments

Comments
 (0)