]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Doc: Fix suggested usage of `-X gil=0` in the glossary (#125366)
authorRuoyu Zhong <zhongruoyu@outlook.com>
Sun, 13 Oct 2024 00:53:28 +0000 (08:53 +0800)
committerGitHub <noreply@github.com>
Sun, 13 Oct 2024 00:53:28 +0000 (01:53 +0100)
Currently, the "global interpreter lock" entry in the glossary mentions
that `-X gil 0` can be used to disable the GIL [1]. However, this is
invalid; the correct usage should be `-X gil=0`.

    $ python -X gil 0 -c 'print("Hello, world")'
    Fatal Python error: config_read_gil: PYTHON_GIL / -X gil must be "0" or "1"
    Python runtime state: preinitialized

    $ python -X gil=0 -c 'print("Hello, world")'
    Hello, world

[1]: https://docs.python.org/3/using/cmdline.html#cmdoption-X

Signed-off-by: Ruoyu Zhong <zhongruoyu@outlook.com>
Doc/glossary.rst

index 1d407732eef57686ef480057a8b6612b9ea648d7..f67f3ecad0bc406c274dabe5ab52b3f63e2334b3 100644 (file)
@@ -617,7 +617,7 @@ Glossary
 
       As of Python 3.13, the GIL can be disabled using the :option:`--disable-gil`
       build configuration. After building Python with this option, code must be
-      run with :option:`-X gil 0 <-X>` or after setting the :envvar:`PYTHON_GIL=0 <PYTHON_GIL>`
+      run with :option:`-X gil=0 <-X>` or after setting the :envvar:`PYTHON_GIL=0 <PYTHON_GIL>`
       environment variable. This feature enables improved performance for
       multi-threaded applications and makes it easier to use multi-core CPUs
       efficiently. For more details, see :pep:`703`.