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

Skip to content

Commit fe24b71

Browse files
gh-123275: Add tests for PYTHON_GIL=1 and -Xgil=1 (gh-123754)
1 parent f8f7500 commit fe24b71

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
@@ -880,19 +880,29 @@ def test_pythondevmode_env(self):
880880
self.assertEqual(proc.stdout.rstrip(), 'True')
881881
self.assertEqual(proc.returncode, 0, proc)
882882

883-
@unittest.skipUnless(support.Py_GIL_DISABLED,
884-
"PYTHON_GIL and -X gil only supported in Py_GIL_DISABLED builds")
885883
def test_python_gil(self):
886884
cases = [
887885
# (env, opt, expected, msg)
888-
(None, None, 'None', "no options set"),
889-
('0', None, '0', "PYTHON_GIL=0"),
890886
('1', None, '1', "PYTHON_GIL=1"),
891-
('1', '0', '0', "-X gil=0 overrides PYTHON_GIL=1"),
892-
(None, '0', '0', "-X gil=0"),
893887
(None, '1', '1', "-X gil=1"),
894888
]
895889

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

0 commit comments

Comments
 (0)
0