Skip to content

Commit

Permalink
Disable the GIL by default
Browse files Browse the repository at this point in the history
  • Loading branch information
colesbury committed Apr 27, 2023
1 parent d595911 commit 4526c07
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
2 changes: 0 additions & 2 deletions Lib/subprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,6 @@ def _args_from_interpreter_flags():
# -X options
if dev_mode:
args.extend(('-X', 'dev'))
if sys.flags.nogil:
args.extend(('-X', 'nogil'))
for opt in ('faulthandler', 'tracemalloc', 'importtime',
'showrefcount', 'utf8'):
if opt in xoptions:
Expand Down
4 changes: 2 additions & 2 deletions Lib/test/test_capi/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ def test_return_null_without_error(self):
r'SystemError: <built-in function return_null_without_error> '
r'returned NULL without setting an exception\n'
r'\n'
r'Current thread.*:\n'
r'Stack.*:\n'
r' File .*", line 6 in <module>\n')
else:
with self.assertRaises(SystemError) as cm:
Expand Down Expand Up @@ -281,7 +281,7 @@ def test_return_result_with_error(self):
r'function return_result_with_error> '
r'returned a result with an exception set\n'
r'\n'
r'Current thread.*:\n'
r'Stack.*:\n'
r' File .*, line 6 in <module>\n')
else:
with self.assertRaises(SystemError) as cm:
Expand Down
2 changes: 2 additions & 0 deletions Lib/test/test_concurrent_futures.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,9 +485,11 @@ def test_cancel_futures_wait_false(self):
rc, out, err = assert_python_ok('-c', """if True:
from concurrent.futures import ThreadPoolExecutor
from test.test_concurrent_futures import sleep_and_print
import time
if __name__ == "__main__":
t = ThreadPoolExecutor()
t.submit(sleep_and_print, .1, "apple")
time.sleep(0.01) # wait for thread to start sleep_and_print
t.shutdown(wait=False, cancel_futures=True)
""")
# Errors in atexit hooks don't change the process exit code, check
Expand Down
4 changes: 2 additions & 2 deletions Lib/test/test_embed.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase):
use_environment=0,
utf8_mode=0,
dev_mode=0,
disable_gil=0,
disable_gil=1,
coerce_c_locale=0,
)

Expand All @@ -443,7 +443,7 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase):
'isolated': 0,
'use_environment': 1,
'dev_mode': 0,
'disable_gil': 0,
'disable_gil': 1,

'install_signal_handlers': 1,
'use_hash_seed': 0,
Expand Down
2 changes: 1 addition & 1 deletion Python/initconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,7 @@ PyConfig_InitIsolatedConfig(PyConfig *config)
config->use_environment = 0;
config->user_site_directory = 0;
config->dev_mode = 0;
config->disable_gil = 0;
config->disable_gil = 1;
config->install_signal_handlers = 0;
config->use_hash_seed = 0;
config->faulthandler = 0;
Expand Down
2 changes: 1 addition & 1 deletion Python/preconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ _PyPreCmdline_Read(_PyPreCmdline *cmdline, const PyPreConfig *preconfig)
cmdline->disable_gil = (strcmp(env, "0") == 0);
}
else {
cmdline->disable_gil = 0;
cmdline->disable_gil = 1;
}
}

Expand Down

0 comments on commit 4526c07

Please sign in to comment.