Title: test_gdb are not skipped properly if gdb is not available (instead, an uncaught exception is raised) · Issue #110995 · python/cpython · GitHub
Open Graph Title: test_gdb are not skipped properly if gdb is not available (instead, an uncaught exception is raised) · Issue #110995 · python/cpython
X Title: test_gdb are not skipped properly if gdb is not available (instead, an uncaught exception is raised) · Issue #110995 · python/cpython
Description: Bug report Bug description: I'm bootstrapping Python 3.13a1 in Fedora Linux. In my environment I've got gdb built without Python. Now I want to build full Python and run its tests during the RPM build. What happens Tests from package tes...
Open Graph Description: Bug report Bug description: I'm bootstrapping Python 3.13a1 in Fedora Linux. In my environment I've got gdb built without Python. Now I want to build full Python and run its tests during the RPM bu...
X Description: Bug report Bug description: I'm bootstrapping Python 3.13a1 in Fedora Linux. In my environment I've got gdb built without Python. Now I want to build full Python and run its tests during th...
Opengraph URL: https://github.com/python/cpython/issues/110995
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"test_gdb are not skipped properly if gdb is not available (instead, an uncaught exception is raised)","articleBody":"# Bug report\n\n### Bug description:\n\nI'm bootstrapping Python 3.13a1 in Fedora Linux.\nIn my environment I've got `gdb` built without Python. Now I want to build full Python and run its tests during the RPM build.\n\n**What happens**\nTests from package test_gdb fail due to uncaught exception. \n\n**What should happen**\nTests should be marked as skipped and not executed at all.\n\n\n\u003cdetails\u003e\u003csummary\u003eTraceback\u003c/summary\u003e\n\u003cpre\u003e\u003ccode\u003e\n0:28:25 load avg: 2.73 Re-running 5 failed tests in verbose mode in subprocesses\n0:28:25 load avg: 2.73 Run 5 tests in parallel using 2 worker processes (timeout: 45 min, worker timeout: 50 min)\n0:28:26 load avg: 2.73 [1/5/1] test.test_gdb.test_cfunction failed (uncaught exception)\nRe-running test.test_gdb.test_cfunction in verbose mode\ntest test.test_gdb.test_cfunction crashed -- Traceback (most recent call last):\n File \"/builddir/build/BUILD/Python-3.13.0a1/Lib/test/libregrtest/single.py\", line 138, in _runtest_env_changed_exc\n _load_run_test(result, runtests)\n File \"/builddir/build/BUILD/Python-3.13.0a1/Lib/test/libregrtest/single.py\", line 85, in _load_run_test\n test_mod = importlib.import_module(module_name)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/builddir/build/BUILD/Python-3.13.0a1/Lib/importlib/__init__.py\", line 88, in import_module\n return _bootstrap._gcd_import(name[level:], package, level)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"\u003cfrozen importlib._bootstrap\u003e\", line 1381, in _gcd_import\n File \"\u003cfrozen importlib._bootstrap\u003e\", line 1354, in _find_and_load\n File \"\u003cfrozen importlib._bootstrap\u003e\", line 1325, in _find_and_load_unlocked\n File \"\u003cfrozen importlib._bootstrap\u003e\", line 929, in _load_unlocked\n File \"\u003cfrozen importlib._bootstrap_external\u003e\", line 1008, in exec_module\n File \"\u003cfrozen importlib._bootstrap\u003e\", line 488, in _call_with_frames_removed\n File \"/builddir/build/BUILD/Python-3.13.0a1/Lib/test/test_gdb/test_cfunction.py\", line 5, in \u003cmodule\u003e\n from .util import setup_module, DebuggerTests\n File \"/builddir/build/BUILD/Python-3.13.0a1/Lib/test/test_gdb/util.py\", line 124, in \u003cmodule\u003e\n check_usable_gdb()\n File \"/builddir/build/BUILD/Python-3.13.0a1/Lib/test/test_gdb/util.py\", line 107, in check_usable_gdb\n stdout, stderr = run_gdb(\n ^^^^^^^^\n File \"/builddir/build/BUILD/Python-3.13.0a1/Lib/test/test_gdb/util.py\", line 64, in run_gdb\n raise Exception(f\"{cmd_text} failed with exit code {proc.returncode}, \"\nException: gdb --batch -nx --init-eval-command 'add-auto-load-safe-path /builddir/build/BUILD/Python-3.13.0a1/build/debug/python-gdb.py' '--eval-command=python import sys; print(sys.version_info)' --args /builddir/build/BUILD/Python-3.13.0a1/build/debug/python failed with exit code 1, expected exit code 0:\nstdout=''\nstderr='Python scripting is not supported in this copy of GDB.\\n'\n0:28:26 load avg: 2.73 [2/5/2] test.test_gdb.test_backtrace failed (uncaught exception)\nRe-running test.test_gdb.test_backtrace in verbose mode\ntest test.test_gdb.test_backtrace crashed -- Traceback (most recent call last):\n File \"/builddir/build/BUILD/Python-3.13.0a1/Lib/test/libregrtest/single.py\", line 138, in _runtest_env_changed_exc\n _load_run_test(result, runtests)\n File \"/builddir/build/BUILD/Python-3.13.0a1/Lib/test/libregrtest/single.py\", line 85, in _load_run_test\n test_mod = importlib.import_module(module_name)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/builddir/build/BUILD/Python-3.13.0a1/Lib/importlib/__init__.py\", line 88, in import_module\n return _bootstrap._gcd_import(name[level:], package, level)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"\u003cfrozen importlib._bootstrap\u003e\", line 1381, in _gcd_import\n File \"\u003cfrozen importlib._bootstrap\u003e\", line 1354, in _find_and_load\n File \"\u003cfrozen importlib._bootstrap\u003e\", line 1325, in _find_and_load_unlocked\n File \"\u003cfrozen importlib._bootstrap\u003e\", line 929, in _load_unlocked\n File \"\u003cfrozen importlib._bootstrap_external\u003e\", line 1008, in exec_module\n File \"\u003cfrozen importlib._bootstrap\u003e\", line 488, in _call_with_frames_removed\n File \"/builddir/build/BUILD/Python-3.13.0a1/Lib/test/test_gdb/test_backtrace.py\", line 6, in \u003cmodule\u003e\n from .util import setup_module, DebuggerTests, CET_PROTECTION, SAMPLE_SCRIPT\n File \"/builddir/build/BUILD/Python-3.13.0a1/Lib/test/test_gdb/util.py\", line 124, in \u003cmodule\u003e\n check_usable_gdb()\n File \"/builddir/build/BUILD/Python-3.13.0a1/Lib/test/test_gdb/util.py\", line 107, in check_usable_gdb\n stdout, stderr = run_gdb(\n ^^^^^^^^\n File \"/builddir/build/BUILD/Python-3.13.0a1/Lib/test/test_gdb/util.py\", line 64, in run_gdb\n raise Exception(f\"{cmd_text} failed with exit code {proc.returncode}, \"\nException: gdb --batch -nx --init-eval-command 'add-auto-load-safe-path /builddir/build/BUILD/Python-3.13.0a1/build/debug/python-gdb.py' '--eval-command=python import sys; print(sys.version_info)' --args /builddir/build/BUILD/Python-3.13.0a1/build/debug/python failed with exit code 1, expected exit code 0:\nstdout=''\nstderr='Python scripting is not supported in this copy of GDB.\\n'\n0:28:27 load avg: 2.73 [3/5/3] test.test_gdb.test_cfunction_full failed (uncaught exception)\nRe-running test.test_gdb.test_cfunction_full in verbose mode\ntest test.test_gdb.test_cfunction_full crashed -- Traceback (most recent call last):\n File \"/builddir/build/BUILD/Python-3.13.0a1/Lib/test/libregrtest/single.py\", line 138, in _runtest_env_changed_exc\n _load_run_test(result, runtests)\n File \"/builddir/build/BUILD/Python-3.13.0a1/Lib/test/libregrtest/single.py\", line 85, in _load_run_test\n test_mod = importlib.import_module(module_name)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/builddir/build/BUILD/Python-3.13.0a1/Lib/importlib/__init__.py\", line 88, in import_module\n return _bootstrap._gcd_import(name[level:], package, level)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"\u003cfrozen importlib._bootstrap\u003e\", line 1381, in _gcd_import\n File \"\u003cfrozen importlib._bootstrap\u003e\", line 1354, in _find_and_load\n File \"\u003cfrozen importlib._bootstrap\u003e\", line 1325, in _find_and_load_unlocked\n File \"\u003cfrozen importlib._bootstrap\u003e\", line 929, in _load_unlocked\n File \"\u003cfrozen importlib._bootstrap_external\u003e\", line 1008, in exec_module\n File \"\u003cfrozen importlib._bootstrap\u003e\", line 488, in _call_with_frames_removed\n File \"/builddir/build/BUILD/Python-3.13.0a1/Lib/test/test_gdb/test_cfunction_full.py\", line 7, in \u003cmodule\u003e\n from .util import setup_module\n File \"/builddir/build/BUILD/Python-3.13.0a1/Lib/test/test_gdb/util.py\", line 124, in \u003cmodule\u003e\n check_usable_gdb()\n File \"/builddir/build/BUILD/Python-3.13.0a1/Lib/test/test_gdb/util.py\", line 107, in check_usable_gdb\n stdout, stderr = run_gdb(\n ^^^^^^^^\n File \"/builddir/build/BUILD/Python-3.13.0a1/Lib/test/test_gdb/util.py\", line 64, in run_gdb\n raise Exception(f\"{cmd_text} failed with exit code {proc.returncode}, \"\nException: gdb --batch -nx --init-eval-command 'add-auto-load-safe-path /builddir/build/BUILD/Python-3.13.0a1/build/debug/python-gdb.py' '--eval-command=python import sys; print(sys.version_info)' --args /builddir/build/BUILD/Python-3.13.0a1/build/debug/python failed with exit code 1, expected exit code 0:\nstdout=''\nstderr='Python scripting is not supported in this copy of GDB.\\n'\n0:28:27 load avg: 2.73 [4/5/4] test.test_gdb.test_misc failed (uncaught exception)\nRe-running test.test_gdb.test_misc in verbose mode\ntest test.test_gdb.test_misc crashed -- Traceback (most recent call last):\n File \"/builddir/build/BUILD/Python-3.13.0a1/Lib/test/libregrtest/single.py\", line 138, in _runtest_env_changed_exc\n _load_run_test(result, runtests)\n File \"/builddir/build/BUILD/Python-3.13.0a1/Lib/test/libregrtest/single.py\", line 85, in _load_run_test\n test_mod = importlib.import_module(module_name)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/builddir/build/BUILD/Python-3.13.0a1/Lib/importlib/__init__.py\", line 88, in import_module\n return _bootstrap._gcd_import(name[level:], package, level)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"\u003cfrozen importlib._bootstrap\u003e\", line 1381, in _gcd_import\n File \"\u003cfrozen importlib._bootstrap\u003e\", line 1354, in _find_and_load\n File \"\u003cfrozen importlib._bootstrap\u003e\", line 1325, in _find_and_load_unlocked\n File \"\u003cfrozen importlib._bootstrap\u003e\", line 929, in _load_unlocked\n File \"\u003cfrozen importlib._bootstrap_external\u003e\", line 1008, in exec_module\n File \"\u003cfrozen importlib._bootstrap\u003e\", line 488, in _call_with_frames_removed\n File \"/builddir/build/BUILD/Python-3.13.0a1/Lib/test/test_gdb/test_misc.py\", line 5, in \u003cmodule\u003e\n from .util import run_gdb, setup_module, DebuggerTests, SAMPLE_SCRIPT\n File \"/builddir/build/BUILD/Python-3.13.0a1/Lib/test/test_gdb/util.py\", line 124, in \u003cmodule\u003e\n check_usable_gdb()\n File \"/builddir/build/BUILD/Python-3.13.0a1/Lib/test/test_gdb/util.py\", line 107, in check_usable_gdb\n stdout, stderr = run_gdb(\n ^^^^^^^^\n File \"/builddir/build/BUILD/Python-3.13.0a1/Lib/test/test_gdb/util.py\", line 64, in run_gdb\n raise Exception(f\"{cmd_text} failed with exit code {proc.returncode}, \"\nException: gdb --batch -nx --init-eval-command 'add-auto-load-safe-path /builddir/build/BUILD/Python-3.13.0a1/build/debug/python-gdb.py' '--eval-command=python import sys; print(sys.version_info)' --args /builddir/build/BUILD/Python-3.13.0a1/build/debug/python failed with exit code 1, expected exit code 0:\nstdout=''\nstderr='Python scripting is not supported in this copy of GDB.\\n'\n0:28:27 load avg: 2.73 [5/5/5] test.test_gdb.test_pretty_print failed (uncaught exception)\nRe-running test.test_gdb.test_pretty_print in verbose mode\ntest test.test_gdb.test_pretty_print crashed -- Traceback (most recent call last):\n File \"/builddir/build/BUILD/Python-3.13.0a1/Lib/test/libregrtest/single.py\", line 138, in _runtest_env_changed_exc\n _load_run_test(result, runtests)\n File \"/builddir/build/BUILD/Python-3.13.0a1/Lib/test/libregrtest/single.py\", line 85, in _load_run_test\n test_mod = importlib.import_module(module_name)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/builddir/build/BUILD/Python-3.13.0a1/Lib/importlib/__init__.py\", line 88, in import_module\n return _bootstrap._gcd_import(name[level:], package, level)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"\u003cfrozen importlib._bootstrap\u003e\", line 1381, in _gcd_import\n File \"\u003cfrozen importlib._bootstrap\u003e\", line 1354, in _find_and_load\n File \"\u003cfrozen importlib._bootstrap\u003e\", line 1325, in _find_and_load_unlocked\n File \"\u003cfrozen importlib._bootstrap\u003e\", line 929, in _load_unlocked\n File \"\u003cfrozen importlib._bootstrap_external\u003e\", line 1008, in exec_module\n File \"\u003cfrozen importlib._bootstrap\u003e\", line 488, in _call_with_frames_removed\n File \"/builddir/build/BUILD/Python-3.13.0a1/Lib/test/test_gdb/test_pretty_print.py\", line 5, in \u003cmodule\u003e\n from .util import (\n File \"/builddir/build/BUILD/Python-3.13.0a1/Lib/test/test_gdb/util.py\", line 124, in \u003cmodule\u003e\n check_usable_gdb()\n File \"/builddir/build/BUILD/Python-3.13.0a1/Lib/test/test_gdb/util.py\", line 107, in check_usable_gdb\n stdout, stderr = run_gdb(\n ^^^^^^^^\n File \"/builddir/build/BUILD/Python-3.13.0a1/Lib/test/test_gdb/util.py\", line 64, in run_gdb\n raise Exception(f\"{cmd_text} failed with exit code {proc.returncode}, \"\nException: gdb --batch -nx --init-eval-command 'add-auto-load-safe-path /builddir/build/BUILD/Python-3.13.0a1/build/debug/python-gdb.py' '--eval-command=python import sys; print(sys.version_info)' --args /builddir/build/BUILD/Python-3.13.0a1/build/debug/python failed with exit code 1, expected exit code 0:\nstdout=''\nstderr='Python scripting is not supported in this copy of GDB.\\n'\n5 tests failed again:\n test.test_gdb.test_backtrace test.test_gdb.test_cfunction\n test.test_gdb.test_cfunction_full test.test_gdb.test_misc\n test.test_gdb.test_pretty_print\n\u003c/code\u003e\u003c/pre\u003e\n\u003c/details\u003e \n\nI believe the refactoring done in #110026 has introduced a regression. `run_gdb()` used to always return a tuple `(stdout, stderr)`, but now it checks exitcode and raises an exception in case it's not what was expected. `check_usable_gdb()` consumes the values returned from `run_gdb()` and only then marks tests as skipped, but in this case the exception breaks the test run even before this can happen. \n\ncc: @vstinner \n\n\n\n\n### CPython versions tested on:\n\nCPython main branch\n\n### Operating systems tested on:\n\nLinux\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-110998\n* gh-111003\n* gh-111004\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/befeleme","@type":"Person","name":"befeleme"},"datePublished":"2023-10-17T15:34:20.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/110995/cpython/issues/110995"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:fb7d4fd0-b81b-a9cb-8d70-d9b3c761ccf5 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A126:2BBD61:862D55:B70586:696AB4A7 |
| html-safe-nonce | 5495091d4b13ea43eaeea410446556043e775d6f2a04392e6f37046bce4ac1dd |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMTI2OjJCQkQ2MTo4NjJENTU6QjcwNTg2OjY5NkFCNEE3IiwidmlzaXRvcl9pZCI6IjIzODc4NjkxNzI1NzQ2MzEwNzkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | c63727a7d1f30498511129c46718f9435153c843b9ba6336c12dab907088a2f5 |
| hovercard-subject-tag | issue:1947713806 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/110995/issue_layout |
| twitter:image | https://opengraph.githubassets.com/32f01814f25f712c6abc4a1293a47b6b7d1541a3a6b4c1c54abc2c07df25b0bc/python/cpython/issues/110995 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/32f01814f25f712c6abc4a1293a47b6b7d1541a3a6b4c1c54abc2c07df25b0bc/python/cpython/issues/110995 |
| og:image:alt | Bug report Bug description: I'm bootstrapping Python 3.13a1 in Fedora Linux. In my environment I've got gdb built without Python. Now I want to build full Python and run its tests during the RPM bu... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | befeleme |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4fa1799b6a53c2d30c950d74230781bef9e7f61138c72c7727e4b83f0743752b |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 41f276818bd204c4a30a0281fb3c576298d9474c |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width