Skip to content

Conversation

@ZhongRuoyu
Copy link
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 <[email protected]>
@ghost
Copy link

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
33 checks passed
@miss-islington-app
Copy link

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 <[email protected]>
Signed-off-by: Ruoyu Zhong <[email protected]>
@bedevere-app
Copy link

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 <[email protected]>
Co-authored-by: Ruoyu Zhong <[email protected]>
@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