8000 Configure GIL in ceval_gil.c · python/cpython@167b434 · GitHub
[go: up one dir, main page]

Skip to content

Commit 167b434

Browse files
committed
Configure GIL in ceval_gil.c
1 parent 9fc88f4 commit 167b434

File tree

4 files changed

+4
-6
lines changed

4 files changed

+4
-6
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, '0', "no options set"),
887+
(None, None, 'None', "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'] = 0
537+
CONFIG_COMPAT['enable_gil'] = -1
538538
if MS_WINDOWS:
539539
CONFIG_COMPAT.update({
540540
'legacy_windows_stdio': 0,

Python/ceval_gil.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -451,9 +451,7 @@ init_own_gil(PyInterpreterState *interp, struct _gil_runtime_state *gil)
451451
{
452452
assert(!gil_created(gil));
453453
#ifdef Py_GIL_DISABLED
454-
// gh-116329: Once it is safe to do so, change this condition to
455-
// (enable_gil == _PyConfig_GIL_ENABLE), so the GIL is disabled by default.
456-
gil->enabled = _PyInterpreterState_GetConfig(interp)->enable_gil != _PyConfig_GIL_DISABLE;
454+
gil->enabled = _PyInterpreterState_GetConfig(interp)->enable_gil == _PyConfig_GIL_ENABLE;
457455
#endif
458456
create_gil(gil);
459457
assert(gil_created(gil));

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_DISABLE;
850+
config->enable_gil = _PyConfig_GIL_DEFAULT;
851851
#endif
852852
}
853853

0 commit comments

Comments
 (0)
0