From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Tue, 5 Aug 2025 17:34:47 +0000 (+0200) Subject: [3.14] gh-137194: Fix requires_debug_ranges when _testcpi doesn't exist (GH-137195... X-Git-Tag: v3.14.0rc2~31 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7d57316484e4b8b07f1ca42829933c1808eaabb3;p=thirdparty%2FPython%2Fcpython.git [3.14] gh-137194: Fix requires_debug_ranges when _testcpi doesn't exist (GH-137195) (#137274) Co-authored-by: Jeong, YunWon <69878+youknowone@users.noreply.github.com> --- diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py index 9e08a7321be5..cd7f40656577 100644 --- a/Lib/test/support/__init__.py +++ b/Lib/test/support/__init__.py @@ -544,7 +544,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) MS_WINDOWS = (sys.platform == 'win32')