Skip to content

Commit 4526c07

Browse files
committed
Disable the GIL by default
1 parent d595911 commit 4526c07

File tree

6 files changed

+8
-8
lines changed

6 files changed

+8
-8
lines changed

Lib/subprocess.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,8 +345,6 @@ def _args_from_interpreter_flags():
345345
# -X options
346346
if dev_mode:
347347
args.extend(('-X', 'dev'))
348-
if sys.flags.nogil:
349-
args.extend(('-X', 'nogil'))
350348
for opt in ('faulthandler', 'tracemalloc', 'importtime',
351349
'showrefcount', 'utf8'):
352350
if opt in xoptions:

Lib/test/test_capi/test_misc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ def test_return_null_without_error(self):
247247
r'SystemError: <built-in function return_null_without_error> '
248248
r'returned NULL without setting an exception\n'
249249
r'\n'
250-
r'Current thread.*:\n'
250+
r'Stack.*:\n'
251251
r' File .*", line 6 in <module>\n')
252252
else:
253253
with self.assertRaises(SystemError) as cm:
@@ -281,7 +281,7 @@ def test_return_result_with_error(self):
281281
r'function return_result_with_error> '
282282
r'returned a result with an exception set\n'
283283
r'\n'
284-
r'Current thread.*:\n'
284+
r'Stack.*:\n'
285285
r' File .*, line 6 in <module>\n')
286286
else:
287287
with self.assertRaises(SystemError) as cm:

Lib/test/test_concurrent_futures.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,9 +485,11 @@ def test_cancel_futures_wait_false(self):
485485
rc, out, err = assert_python_ok('-c', """if True:
486486
from concurrent.futures import ThreadPoolExecutor
487487
from test.test_concurrent_futures import sleep_and_print
488+
import time
488489
if __name__ == "__main__":
489490
t = ThreadPoolExecutor()
490491
t.submit(sleep_and_print, .1, "apple")
492+
time.sleep(0.01) # wait for thread to start sleep_and_print
491493
t.shutdown(wait=False, cancel_futures=True)
492494
""")
493495
# Errors in atexit hooks don't change the process exit code, check

Lib/test/test_embed.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase):
427427
use_environment=0,
428428
utf8_mode=0,
429429
dev_mode=0,
430-
disable_gil=0,
430+
disable_gil=1,
431431
coerce_c_locale=0,
432432
)
433433

@@ -443,7 +443,7 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase):
443443
'isolated': 0,
444444
'use_environment': 1,
445445
'dev_mode': 0,
446-
'disable_gil': 0,
446+
'disable_gil': 1,
447447

448448
'install_signal_handlers': 1,
449449
'use_hash_seed': 0,

Python/initconfig.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,7 @@ PyConfig_InitIsolatedConfig(PyConfig *config)
866866
config->use_environment = 0;
867867
config->user_site_directory = 0;
868868
config->dev_mode = 0;
869-
config->disable_gil = 0;
869+
config->disable_gil = 1;
870870
config->install_signal_handlers = 0;
871871
config->use_hash_seed = 0;
872872
config->faulthandler = 0;

Python/preconfig.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ _PyPreCmdline_Read(_PyPreCmdline *cmdline, const PyPreConfig *preconfig)
280280
cmdline->disable_gil = (strcmp(env, "0") == 0);
281281
}
282282
else {
283-
cmdline->disable_gil = 0;
283+
cmdline->disable_gil = 1;
284284
}
285285
}
286286

0 commit comments

Comments
 (0)