From 3aa402aafd57cbc41e56280940141a61ebe68bf4 Mon Sep 17 00:00:00 2001 From: Sam Gross Date: Tue, 2 Apr 2024 18:03:44 +0000 Subject: [PATCH 1/2] gh-117474: Skip GIL test in free-threaded build In the free-threaded build, the GIL will typically be disabled so py-bt will not show threads waiting on the GIL. --- Lib/test/test_gdb/test_backtrace.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Lib/test/test_gdb/test_backtrace.py b/Lib/test/test_gdb/test_backtrace.py index c41e7cb7c210de..b9a607ac0fa041 100644 --- a/Lib/test/test_gdb/test_backtrace.py +++ b/Lib/test/test_gdb/test_backtrace.py @@ -49,6 +49,7 @@ def test_bt_full(self): @unittest.skipIf(python_is_optimized(), "Python was compiled with optimizations") + @unittest.skipIf(support.Py_GIL_DISABLED, "test requires the GIL") @support.requires_resource('cpu') def test_threads(self): 'Verify that "py-bt" indicates threads that are waiting for the GIL' From 376051b18c1be1160e898757c0e9792065c1c72e Mon Sep 17 00:00:00 2001 From: Sam Gross Date: Thu, 4 Apr 2024 18:12:36 +0000 Subject: [PATCH 2/2] Use support.requires_gil_enabled --- Lib/test/test_gdb/test_backtrace.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/test_gdb/test_backtrace.py b/Lib/test/test_gdb/test_backtrace.py index b9a607ac0fa041..fe67bf9ecc8880 100644 --- a/Lib/test/test_gdb/test_backtrace.py +++ b/Lib/test/test_gdb/test_backtrace.py @@ -49,7 +49,7 @@ def test_bt_full(self): @unittest.skipIf(python_is_optimized(), "Python was compiled with optimizations") - @unittest.skipIf(support.Py_GIL_DISABLED, "test requires the GIL") + @support.requires_gil_enabled @support.requires_resource('cpu') def test_threads(self): 'Verify that "py-bt" indicates threads that are waiting for the GIL'