From 55f8fe548ada912f6fb03383d468160fcffd430d Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Mon, 4 Aug 2025 15:22:15 +0200 Subject: [PATCH] [3.13] gh-137194: Fix requires_debug_ranges when _testcpi doesn't exist (GH-137195) (GH-137275) (cherry picked from commit 0282eef880c8c8db782a2088b0257250e0f76d48) Co-authored-by: Jeong, YunWon <69878+youknowone@users.noreply.github.com> --- Lib/test/support/__init__.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py index 60dbdaa33377..c60fc03064f3 100644 --- a/Lib/test/support/__init__.py +++ b/Lib/test/support/__init__.py @@ -512,7 +512,12 @@ def has_no_debug_ranges(): return not bool(config['code_debug_ranges']) def requires_debug_ranges(reason='requires co_positions / debug_ranges'): - return unittest.skipIf(has_no_debug_ranges(), reason) + try: + skip = has_no_debug_ranges() + except unittest.SkipTest as e: + skip = True + reason = e.args[0] if e.args else reason + return unittest.skipIf(skip, reason) @contextlib.contextmanager def suppress_immortalization(suppress=True): -- 2.47.3