From 4515c614bfa3bb51f535f71ee44b951af52db5c4 Mon Sep 17 00:00:00 2001 From: ShaharNaveh <50263213+ShaharNaveh@users.noreply.github.com> Date: Wed, 16 Jul 2025 13:12:30 +0300 Subject: [PATCH] mark more tests --- Lib/test/support/__init__.py | 24 ++++++++++++++++++++---- Lib/test/test_traceback.py | 2 ++ 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py index ec889ecc4..26a8b1672 100644 --- a/Lib/test/support/__init__.py +++ b/Lib/test/support/__init__.py @@ -840,11 +840,27 @@ def python_is_optimized(): return final_opt not in ('', '-O0', '-Og') -_header = 'nP' +# From CPython 3.13.5 +Py_GIL_DISABLED = bool(sysconfig.get_config_var('Py_GIL_DISABLED')) + +# From CPython 3.13.5 +def requires_gil_enabled(msg="needs the GIL enabled"): + """Decorator for skipping tests on the free-threaded build.""" + return unittest.skipIf(Py_GIL_DISABLED, msg) + +# From CPython 3.13.5 +def expected_failure_if_gil_disabled(): + """Expect test failure if the GIL is disabled.""" + if Py_GIL_DISABLED: + return unittest.expectedFailure + return lambda test_case: test_case + +# From CPython 3.13.5 +if Py_GIL_DISABLED: + _header = 'PHBBInP' +else: + _header = 'nP' _align = '0n' -if hasattr(sys, "getobjects"): - _header = '2P' + _header - _align = '0P' _vheader = _header + 'n' def calcobjsize(fmt): diff --git a/Lib/test/test_traceback.py b/Lib/test/test_traceback.py index 253dacb3c..9d95903d5 100644 --- a/Lib/test/test_traceback.py +++ b/Lib/test/test_traceback.py @@ -430,6 +430,8 @@ class TracebackCases(unittest.TestCase): self.assertEqual(len(err), 1) self.assertEqual(err[-1], 'SyntaxError: error\n') + # TODO: RUSTPYTHON; IndexError: index out of range + @unittest.expectedFailure @requires_subprocess() @force_not_colorized def test_encoded_file(self):