File tree Expand file tree Collapse file tree 2 files changed +22
-4
lines changed
Expand file tree Collapse file tree 2 files changed +22
-4
lines changed Original file line number Diff line number Diff line change @@ -840,11 +840,27 @@ def python_is_optimized():
840840 return final_opt not in ('' , '-O0' , '-Og' )
841841
842842
843- _header = 'nP'
843+ # From CPython 3.13.5
844+ Py_GIL_DISABLED = bool (sysconfig .get_config_var ('Py_GIL_DISABLED' ))
845+
846+ # From CPython 3.13.5
847+ def requires_gil_enabled (msg = "needs the GIL enabled" ):
848+ """Decorator for skipping tests on the free-threaded build."""
849+ return unittest .skipIf (Py_GIL_DISABLED , msg )
850+
851+ # From CPython 3.13.5
852+ def expected_failure_if_gil_disabled ():
853+ """Expect test failure if the GIL is disabled."""
854+ if Py_GIL_DISABLED :
855+ return unittest .expectedFailure
856+ return lambda test_case : test_case
857+
858+ # From CPython 3.13.5
859+ if Py_GIL_DISABLED :
860+ _header = 'PHBBInP'
861+ else :
862+ _header = 'nP'
844863_align = '0n'
845- if hasattr (sys , "getobjects" ):
846- _header = '2P' + _header
847- _align = '0P'
848864_vheader = _header + 'n'
849865
850866def calcobjsize (fmt ):
Original file line number Diff line number Diff line change @@ -430,6 +430,8 @@ def test_format_exception_group_syntax_error_with_custom_values(self):
430430 self .assertEqual (len (err ), 1 )
431431 self .assertEqual (err [- 1 ], 'SyntaxError: error\n ' )
432432
433+ # TODO: RUSTPYTHON; IndexError: index out of range
434+ @unittest .expectedFailure
433435 @requires_subprocess ()
434436 @force_not_colorized
435437 def test_encoded_file (self ):
You can’t perform that action at this time.
0 commit comments