summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorPeter Bierma <zintensitydev@gmail.com>2024-09-05 23:53:47 (GMT)
committerGitHub <noreply@github.com>2024-09-05 23:53:47 (GMT)
commit84ad264ce602fb263a46a4536377bdc830eea81e (patch)
tree0c863a2ab969e2362f6f3e5942bc7bf742e11774 /Python
parent42f52431e9961d5236b33a68af16cca07b74d02c (diff)
downloadcpython-84ad264ce602fb263a46a4536377bdc830eea81e.zip
cpython-84ad264ce602fb263a46a4536377bdc830eea81e.tar.gz
cpython-84ad264ce602fb263a46a4536377bdc830eea81e.tar.bz2
gh-123275: Support `-Xgil=1` and `PYTHON_GIL=1` on non-free-threaded builds (gh-123276)
Diffstat (limited to 'Python')
-rw-r--r--Python/initconfig.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/Python/initconfig.c b/Python/initconfig.c
index 2e7623f..d93244f 100644
--- a/Python/initconfig.c
+++ b/Python/initconfig.c
@@ -1714,20 +1714,24 @@ config_wstr_to_int(const wchar_t *wstr, int *result)
static PyStatus
config_read_gil(PyConfig *config, size_t len, wchar_t first_char)
{
-#ifdef Py_GIL_DISABLED
if (len == 1 && first_char == L'0') {
+#ifdef Py_GIL_DISABLED
config->enable_gil = _PyConfig_GIL_DISABLE;
+#else
+ return _PyStatus_ERR("Disabling the GIL is not supported by this build");
+#endif
}
else if (len == 1 && first_char == L'1') {
+#ifdef Py_GIL_DISABLED
config->enable_gil = _PyConfig_GIL_ENABLE;
+#else
+ return _PyStatus_OK();
+#endif
}
else {
return _PyStatus_ERR("PYTHON_GIL / -X gil must be \"0\" or \"1\"");
}
return _PyStatus_OK();
-#else
- return _PyStatus_ERR("PYTHON_GIL / -X gil are not supported by this build");
-#endif
}
static PyStatus