Skip to content

Doc/glossary.rst: fix -X gil option usage#125366

Merged
AA-Turner merged 1 commit into
python:mainfrom
ZhongRuoyu:doc-glossary-fix-gil-option-usage
Oct 13, 2024
Merged

Doc/glossary.rst: fix -X gil option usage#125366
AA-Turner merged 1 commit into
python:mainfrom
ZhongRuoyu:doc-glossary-fix-gil-option-usage

Conversation

@ZhongRuoyu
Copy link
Copy Markdown
Contributor

@ZhongRuoyu ZhongRuoyu commented Oct 12, 2024

Currently, the "global interpreter lock" entry in the glossary mentions that -X gil 0 can be used to disable the GIL. However, this is invalid; the correct usage should be -X gil=0 1.

$ 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

📚 Documentation preview 📚: https://cpython-previews--125366.org.readthedocs.build/

Footnotes

  1. https://docs.python.org/3.13/using/cmdline.html#cmdoption-X

Currently, the "global interpreter lock" entry in the glossary mentions
that `-X gil 0` can be used to disable the GIL. However, this is
invalid; the correct usage should be `-X gil=0` [^1].

    $ 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.13/using/cmdline.html#cmdoption-X

Signed-off-by: Ruoyu Zhong <zhongruoyu@outlook.com>
@ghost
Copy link
Copy Markdown

ghost commented Oct 12, 2024

All commit authors signed the Contributor License Agreement.
CLA signed

@bedevere-app bedevere-app Bot added docs Documentation in the Doc dir skip news awaiting review labels Oct 12, 2024
@picnixz

This comment was marked as off-topic.

@AA-Turner AA-Turner merged commit a8fa4ad into python:main Oct 13, 2024
@miss-islington-app
Copy link
Copy Markdown

Thanks @ZhongRuoyu for the PR, and @AA-Turner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 13, 2024
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.htmlGH-cmdoption-X

(cherry picked from commit a8fa4ad)

Co-authored-by: Ruoyu Zhong <zhongruoyu@outlook.com>
Signed-off-by: Ruoyu Zhong <zhongruoyu@outlook.com>
@bedevere-app
Copy link
Copy Markdown

bedevere-app Bot commented Oct 13, 2024

GH-125382 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 bugs and security fixes label Oct 13, 2024
AA-Turner pushed a commit that referenced this pull request Oct 13, 2024
) (#125382)

Doc: Fix suggested usage of `-X gil=0` in the glossary (GH-125366)

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.htmlGH-cmdoption-X

(cherry picked from commit a8fa4ad)

Signed-off-by: Ruoyu Zhong <zhongruoyu@outlook.com>
Co-authored-by: Ruoyu Zhong <zhongruoyu@outlook.com>
@ZhongRuoyu ZhongRuoyu deleted the doc-glossary-fix-gil-option-usage branch October 13, 2024 01:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir skip issue skip news

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants