Skip to content

Commit 9fc88f4

Browse files
committed
gh-116749: Disable GIL by default in free-threaded build
Switch GIL to disabled by default in free-threaded build so that the free-threaded CIs catch thread-safety issues.
1 parent d5df252 commit 9fc88f4

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

Lib/test/test_cmd_line.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -884,7 +884,7 @@ def test_pythondevmode_env(self):
884884
def test_python_gil(self):
885885
cases = [
886886
# (env, opt, expected, msg)
887-
(None, None, 'None', "no options set"),
887+
(None, None, '0', "no options set"),
888888
('0', None, '0', "PYTHON_GIL=0"),
889889
('1', None, '1', "PYTHON_GIL=1"),
890890
('1', '0', '0', "-X gil=0 overrides PYTHON_GIL=1"),

Lib/test/test_embed.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase):
534534
if support.Py_DEBUG:
535535
CONFIG_COMPAT['run_presite'] = None
536536
if support.Py_GIL_DISABLED:
537-
CONFIG_COMPAT['enable_gil'] = -1
537+
CONFIG_COMPAT['enable_gil'] = 0
538538
if MS_WINDOWS:
539539
CONFIG_COMPAT.update({
540540
'legacy_windows_stdio': 0,

Python/initconfig.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -847,7 +847,7 @@ _PyConfig_InitCompatConfig(PyConfig *config)
847847
config->code_debug_ranges = 1;
848848
config->cpu_count = -1;
849849
#ifdef Py_GIL_DISABLED
850-
config->enable_gil = _PyConfig_GIL_DEFAULT;
850+
config->enable_gil = _PyConfig_GIL_DISABLE;
851851
#endif
852852
}
853853

0 commit comments

Comments
 (0)