Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-127314: Don't mention the GIL when calling without a thread state on the free-threaded build #127315

Merged
merged 13 commits into from
Dec 6, 2024

Conversation

ZeroIntensity
Copy link
Member

@ZeroIntensity ZeroIntensity commented Nov 27, 2024

Releasing the thread state via Py_BEGIN_ALLOW_THREADS can be confusing for users on free-threading, because the common error messages that come up mention that the GIL must be held, but that won't make sense if it's disabled.

(Technically, the part of the new message mentioning Py_BEGIN_ALLOW_THREADS is true for the default build as well, but I don't see enough justification to change it there too.)

Objects/obmalloc.c Outdated Show resolved Hide resolved
Include/internal/pycore_pystate.h Outdated Show resolved Hide resolved
ZeroIntensity and others added 4 commits December 2, 2024 11:20
@ZeroIntensity
Copy link
Member Author

Apologies for the notification spam with the commits, I'm a bit on the go right now so I had to do it from GH. It's all updated now.

ZeroIntensity and others added 3 commits December 3, 2024 07:24
Co-authored-by: Victor Stinner <vstinner@python.org>
Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I like "active thread state" for Free Threading.

Copy link
Contributor

@colesbury colesbury left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM as well

@vstinner vstinner merged commit 12680ec into python:main Dec 6, 2024
45 checks passed
@vstinner
Copy link
Member

vstinner commented Dec 6, 2024

Merged, thank you.

@ZeroIntensity ZeroIntensity deleted the nogil-tstate-error-message branch December 6, 2024 16:11
srinivasreddy pushed a commit to srinivasreddy/cpython that referenced this pull request Jan 8, 2025
…state on the free-threaded build (python#127315)

Co-authored-by: Victor Stinner <vstinner@python.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants