Skip to content

Commit 585bf15

Browse files
authored
Merge branch 'main' into main
2 parents d2f1052 + d359c7c commit 585bf15

File tree

8 files changed

+39
-25
lines changed

8 files changed

+39
-25
lines changed

Doc/using/cmdline.rst

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@ Miscellaneous options
622622
.. versionadded:: 3.13
623623

624624
* :samp:`-X gil={0,1}` forces the GIL to be disabled or enabled,
625-
respectively. Only available in builds configured with
625+
respectively. Setting to ``0`` is only available in builds configured with
626626
:option:`--disable-gil`. See also :envvar:`PYTHON_GIL` and
627627
:ref:`whatsnew313-free-threaded-cpython`.
628628

@@ -1221,13 +1221,12 @@ conflict.
12211221
.. envvar:: PYTHON_GIL
12221222

12231223
If this variable is set to ``1``, the global interpreter lock (GIL) will be
1224-
forced on. Setting it to ``0`` forces the GIL off.
1224+
forced on. Setting it to ``0`` forces the GIL off (needs Python configured with
1225+
the :option:`--disable-gil` build option).
12251226

12261227
See also the :option:`-X gil <-X>` command-line option, which takes
12271228
precedence over this variable, and :ref:`whatsnew313-free-threaded-cpython`.
12281229

1229-
Needs Python configured with the :option:`--disable-gil` build option.
1230-
12311230
.. versionadded:: 3.13
12321231

12331232
Debug-mode variables

Lib/test/test_cmd_line.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -880,19 +880,29 @@ def test_pythondevmode_env(self):
880880
self.assertEqual(proc.stdout.rstrip(), 'True')
881881
self.assertEqual(proc.returncode, 0, proc)
882882

883-
@unittest.skipUnless(support.Py_GIL_DISABLED,
884-
"PYTHON_GIL and -X gil only supported in Py_GIL_DISABLED builds")
885883
def test_python_gil(self):
886884
cases = [
887885
# (env, opt, expected, msg)
888-
(None, None, 'None', "no options set"),
889-
('0', None, '0', "PYTHON_GIL=0"),
890886
('1', None, '1', "PYTHON_GIL=1"),
891-
('1', '0', '0', "-X gil=0 overrides PYTHON_GIL=1"),
892-
(None, '0', '0', "-X gil=0"),
893887
(None, '1', '1', "-X gil=1"),
894888
]
895889

890+
if support.Py_GIL_DISABLED:
891+
cases.extend(
892+
[
893+
(None, None, 'None', "no options set"),
894+
('0', None, '0', "PYTHON_GIL=0"),
895+
('1', '0', '0', "-X gil=0 overrides PYTHON_GIL=1"),
896+
(None, '0', '0', "-X gil=0"),
897+
]
898+
)
899+
else:
900+
cases.extend(
901+
[
902+
(None, None, '1', '-X gil=0 (unsupported by this build)'),
903+
('1', None, '1', 'PYTHON_GIL=0 (unsupported by this build)'),
904+
]
905+
)
896906
code = "import sys; print(sys.flags.gil)"
897907
environ = dict(os.environ)
898908

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Support :option:`-X gil=1 <-X>` and :envvar:`PYTHON_GIL=1 <PYTHON_GIL>` on non-free-threaded builds.

Misc/sbom.spdx.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/_hacl/Lib_Memzero0.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include <string.h>
1414
#endif
1515

16-
#ifdef __FreeBSD__
16+
#if defined(__FreeBSD__) || defined(__NetBSD__)
1717
#include <strings.h>
1818
#endif
1919

Python/initconfig.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1714,20 +1714,24 @@ config_wstr_to_int(const wchar_t *wstr, int *result)
17141714
static PyStatus
17151715
config_read_gil(PyConfig *config, size_t len, wchar_t first_char)
17161716
{
1717-
#ifdef Py_GIL_DISABLED
17181717
if (len == 1 && first_char == L'0') {
1718+
#ifdef Py_GIL_DISABLED
17191719
config->enable_gil = _PyConfig_GIL_DISABLE;
1720+
#else
1721+
return _PyStatus_ERR("Disabling the GIL is not supported by this build");
1722+
#endif
17201723
}
17211724
else if (len == 1 && first_char == L'1') {
1725+
#ifdef Py_GIL_DISABLED
17221726
config->enable_gil = _PyConfig_GIL_ENABLE;
1727+
#else
1728+
return _PyStatus_OK();
1729+
#endif
17231730
}
17241731
else {
17251732
return _PyStatus_ERR("PYTHON_GIL / -X gil must be \"0\" or \"1\"");
17261733
}
17271734
return _PyStatus_OK();
1728-
#else
1729-
return _PyStatus_ERR("PYTHON_GIL / -X gil are not supported by this build");
1730-
#endif
17311735
}
17321736

17331737
static PyStatus

configure

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configure.ac

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -418,9 +418,9 @@ if test -z "$CPP"; then
418418
fi
419419
if test -z "$CXX"; then
420420
case "$host" in
421-
aarch64-apple-ios*-simulator) CXX=arm64-apple-ios-simulator-clang ;;
422-
aarch64-apple-ios*) CXX=arm64-apple-ios-clang ;;
423-
x86_64-apple-ios*-simulator) CXX=x86_64-apple-ios-simulator-clang ;;
421+
aarch64-apple-ios*-simulator) CXX=arm64-apple-ios-simulator-clang++ ;;
422+
aarch64-apple-ios*) CXX=arm64-apple-ios-clang++ ;;
423+
x86_64-apple-ios*-simulator) CXX=x86_64-apple-ios-simulator-clang++ ;;
424424
*)
425425
esac
426426
fi
@@ -758,7 +758,7 @@ if test "$cross_compiling" = yes; then
758758

759759
# IPHONEOS_DEPLOYMENT_TARGET is the minimum supported iOS version
760760
AC_MSG_CHECKING([iOS deployment target])
761-
IPHONEOS_DEPLOYMENT_TARGET=${_host_os:3}
761+
IPHONEOS_DEPLOYMENT_TARGET=$(echo ${_host_os} | cut -c4-)
762762
IPHONEOS_DEPLOYMENT_TARGET=${IPHONEOS_DEPLOYMENT_TARGET:=13.0}
763763
AC_MSG_RESULT([$IPHONEOS_DEPLOYMENT_TARGET])
764764

0 commit comments

Comments
 (0)