-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
gh-124622: Add PyGILState_EnsureOrFail() function #129688
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -1279,6 +1279,21 @@ with sub-interpreters: | |||||||||||||
Hangs the current thread, rather than terminating it, if called while the | ||||||||||||||
interpreter is finalizing. | ||||||||||||||
|
||||||||||||||
|
||||||||||||||
.. c:function:: int PyGILState_EnsureOrFail(PyGILState_STATE *state) | ||||||||||||||
|
||||||||||||||
Similar to :c:func:`PyGILState_Ensure`, except that it returns with a status | ||||||||||||||
code even in the case of failure. Specifically, it returns ``0`` when the | ||||||||||||||
operation succeeded, and ``-1`` otherwise. In contrast to | ||||||||||||||
:c:func:`PyGILState_Ensure`, *state* is an argument. | ||||||||||||||
|
||||||||||||||
In the case of failure, it is *unsafe* to use the Python API following the | ||||||||||||||
call. Releasing the obtained *state* via :c:func:`PyGILState_Release` should | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I applied this suggestion to #130012 since I closed this PR. |
||||||||||||||
only be done in the case of success. | ||||||||||||||
|
||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I meant repeating the note above
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. #130012 PR should be subinterpreter-friendly, I closed this PR instead. |
||||||||||||||
.. versionadded:: next | ||||||||||||||
|
||||||||||||||
|
||||||||||||||
.. c:function:: void PyGILState_Release(PyGILState_STATE) | ||||||||||||||
|
||||||||||||||
Release any resources previously acquired. After this call, Python's state will | ||||||||||||||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Add :c:func:`PyGILState_EnsureOrFail` function: similar to | ||
:c:func:`PyGILState_Ensure`, but return ``-1`` if the thread must exit. | ||
Patch by Victor Stinner. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2545,3 +2545,5 @@ | |
added = '3.14' | ||
[function.Py_PACK_VERSION] | ||
added = '3.14' | ||
[function.PyGILState_EnsureOrFail] | ||
added = '3.14' |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.