Thanks to visit codestin.com
Credit goes to github.com

Skip to content

PyThreadState_DeleteCurrent documentation incorrect #115145

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

Closed
colesbury opened this issue Feb 7, 2024 · 2 comments
Closed

PyThreadState_DeleteCurrent documentation incorrect #115145

colesbury opened this issue Feb 7, 2024 · 2 comments
Labels
docs Documentation in the Doc dir topic-C-API

Comments

@colesbury
Copy link
Contributor

colesbury commented Feb 7, 2024

The documentation for PyThreadState_DeleteCurrent() says:

Destroy the current thread state and release the global interpreter lock. Like PyThreadState_Delete(), the global interpreter lock need not be held. The thread state must have been reset with a previous call to PyThreadState_Clear().

However, calling the function without holding the GIL results in a fatal Python error:

Fatal Python error: _PyThreadState_DeleteCurrent: the function must be called with the GIL held, after Python initialization and before Python finalization, but the GIL is released (the current Python thread state is NULL)

It looks to me like like CPython code since at least 3.8 required holding the GIL when calling PyThreadState_DeleteCurrent(), so I think we should update the documentation rather than change the implementation.

Linked PRs

@colesbury colesbury added docs Documentation in the Doc dir topic-C-API labels Feb 7, 2024
@colesbury
Copy link
Contributor Author

cc @ericsnowcurrently

corona10 added a commit to corona10/cpython that referenced this issue Oct 3, 2024
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Oct 3, 2024
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Oct 3, 2024
corona10 added a commit that referenced this issue Oct 3, 2024
…rrent`` (gh-124920) (gh-124931)

gh-115145: Update documentation about ``PyThreadState_DeleteCurrent`` (gh-124920)
(cherry picked from commit 9eeb21b)

Co-authored-by: Donghee Na <[email protected]>
Yhg1s pushed a commit that referenced this issue Oct 3, 2024
…rrent`` (gh-124920) (#124930)

gh-115145: Update documentation about ``PyThreadState_DeleteCurrent`` (gh-124920)
(cherry picked from commit 9eeb21b)

Co-authored-by: Donghee Na <[email protected]>
@corona10
Copy link
Member

corona10 commented Oct 5, 2024

Let's close this issue cc @colesbury

@corona10 corona10 closed this as completed Oct 5, 2024
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 topic-C-API
Projects
None yet
Development

No branches or pull requests

2 participants