From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Wed, 6 Sep 2023 15:32:36 +0000 (-0700) Subject: [3.11] gh-91960: Skip test_gdb if gdb cannot retrive Python frames (GH-108999) (... X-Git-Tag: v3.11.6~137 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d61b8f9b8b3e8c2fdb3f3f7a24149ca08270b573;p=thirdparty%2FPython%2Fcpython.git [3.11] gh-91960: Skip test_gdb if gdb cannot retrive Python frames (GH-108999) (#109011) gh-91960: Skip test_gdb if gdb cannot retrive Python frames (GH-108999) Skip test_gdb if gdb is unable to retrieve Python frame objects: if a frame is "". When Python is built with "clang -Og", gdb can fail to retrive the 'frame' parameter of _PyEval_EvalFrameDefault(). In this case, tests like py_bt() are likely to fail. Without getting access to Python frames, python-gdb.py is mostly clueless on retrieving the Python traceback. Moreover, test_gdb is no longer skipped on macOS if Python is built with Clang. (cherry picked from commit fbce43a251488f666be9794c908a6613bf8ae260) Co-authored-by: Victor Stinner --- diff --git a/Lib/test/test_gdb.py b/Lib/test/test_gdb.py index bba9b07c6708..d1f9a03a41fd 100644 --- a/Lib/test/test_gdb.py +++ b/Lib/test/test_gdb.py @@ -55,10 +55,6 @@ if gdb_major_version < 7: if not sysconfig.is_python_build(): raise unittest.SkipTest("test_gdb only works on source builds at the moment.") -if 'Clang' in platform.python_compiler() and sys.platform == 'darwin': - raise unittest.SkipTest("test_gdb doesn't work correctly when python is" - " built with LLVM clang") - if ((sysconfig.get_config_var('PGO_PROF_USE_FLAG') or 'xxx') in (sysconfig.get_config_var('PY_CORE_CFLAGS') or '')): raise unittest.SkipTest("test_gdb is not reliable on PGO builds") @@ -247,6 +243,9 @@ class DebuggerTests(unittest.TestCase): for pattern in ( '(frame information optimized out)', 'Unable to read information on python frame', + # gh-91960: On Python built with "clang -Og", gdb gets + # "frame=" for _PyEval_EvalFrameDefault() parameter + '(unable to read python frame information)', ): if pattern in out: raise unittest.SkipTest(f"{pattern!r} found in gdb output") diff --git a/Misc/NEWS.d/next/Tests/2023-09-06-15-36-51.gh-issue-91960.P3nD5v.rst b/Misc/NEWS.d/next/Tests/2023-09-06-15-36-51.gh-issue-91960.P3nD5v.rst new file mode 100644 index 000000000000..46472abf9802 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2023-09-06-15-36-51.gh-issue-91960.P3nD5v.rst @@ -0,0 +1,7 @@ +Skip ``test_gdb`` if gdb is unable to retrieve Python frame objects: if a +frame is ````. When Python is built with "clang -Og", gdb can +fail to retrive the *frame* parameter of ``_PyEval_EvalFrameDefault()``. In +this case, tests like ``py_bt()`` are likely to fail. Without getting access +to Python frames, ``python-gdb.py`` is mostly clueless on retrieving the +Python traceback. Moreover, ``test_gdb`` is no longer skipped on macOS if +Python is built with Clang. Patch by Victor Stinner.