8000 [3.13] gh-123275: Add tests for `PYTHON_GIL=1` and `-Xgil=1` (gh-1237… · python/cpython@fb50266 · GitHub
[go: up one dir, main page]

Skip to content

Commit fb50266

Browse files
[3.13] gh-123275: Add tests for PYTHON_GIL=1 and -Xgil=1 (gh-123754) (gh-123755)
gh-123275: Add tests for `PYTHON_GIL=1` and `-Xgil=1` (gh-123754) (cherry picked from commit fe24b71) Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
1 parent 92b9c44 commit fb50266

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

Lib/test/test_cmd_line.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -879,19 +879,29 @@ def test_pythondevmode_env(self):
879879
self.assertEqual(proc.stdout.rstrip(), 'True')
880880
self.assertEqual(proc.returncode, 0, proc)
881881

882-
@unittest.skipUnless(support.Py_GIL_DISABLED,
883-
"PYTHON_GIL and -X gil only supported in Py_GIL_DISABLED builds")
884882
def test_python_gil(self):
885883
cases = [
886884
# (env, opt, expected, msg)
887-
(None, None, 'None', "no options set"),
888-
('0', None, '0', "PYTHON_GIL=0"),
889885
('1', None, '1', "PYTHON_GIL=1"),
890-
('1', '0', '0', "-X gil=0 overrides PYTHON_GIL=1"),
891-
(None, '0', '0', "-X gil=0"),
892886
(None, '1', '1', "-X gil=1"),
893887
]
894888

889+
if support.Py_GIL_DISABLED:
890+
cases.extend(
891+
[
892+
(None, None, 'None', "no options set"),
893+
('0', None, '0', "PYTHON_GIL=0"),
894+
('1', '0', '0', "-X gil=0 overrides PYTHON_GIL=1"),
895+
(None, '0', '0', "-X gil=0"),
896+
]
897+
)
898+
else:
899+
cases.extend(
900+
[
901+
(None, None, '1', '-X gil=0 (unsupported by this build)'),
902+
('1', None, '1', 'PYTHON_GIL=0 (unsupported by this build)'),
903+
]
904+
)
895905
code = "import sys; print(sys.flags.gil)"
896906
environ = dict(os.environ)
897907

0 commit comments

Comments
 (0)
0