mirror of
https://github.com/python/cpython.git
synced 2025-07-24 19:54:21 +00:00
[3.13] gh-123275: Support -Xgil=1
and PYTHON_GIL=1
on non-free-threaded builds (gh-123276) (gh-123753)
gh-123275: Support `-Xgil=1` and `PYTHON_GIL=1` on non-free-threaded builds (gh-123276)
(cherry picked from commit 84ad264ce6
)
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
This commit is contained in:
parent
e5568e5e9d
commit
92b9c4482f
3 changed files with 12 additions and 8 deletions
|
@ -1542,20 +1542,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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue