bpo-37878: Make PyThreadState_DeleteCurrent() Internal#15315
Conversation
Sorry, something went wrong.
willingc
left a comment
There was a problem hiding this comment.
Thanks @nanjekyejoannah for the PR. I've made some suggested wording changes for reader clarity.
Sorry, something went wrong.
Co-Authored-By: Carol Willing <carolcode@willingconsulting.com>
Co-Authored-By: Carol Willing <carolcode@willingconsulting.com>
|
Let's give @ericsnowcurrently a chance to review too. Thanks. Please ping me if this is still open later this week and I will merge. |
Sorry, something went wrong.
vstinner
left a comment
There was a problem hiding this comment.
I'm not sure that it's a good idea to document this function: https://bugs.python.org/issue37878#msg349954
Sorry, something went wrong.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
Sorry, something went wrong.
|
@vstinner, I made the function internal instead. PTAL |
Sorry, something went wrong.
I dismiss Carol's review since Joannah rewrote her PR, and Carol approved the previous version of the PR.
vstinner
left a comment
There was a problem hiding this comment.
Since it is a public function, even if it's not documented, please document the removal at:
https://docs.python.org/dev/whatsnew/3.9.html#removed
You can mention that the removed function was not documented.
For example, in Python 3.8, I wrote:
"The PyByteArray_Init() and PyByteArray_Fini() functions have been removed. They did nothing since Python 2.7.4 and Python 3.2.0, were excluded from the limited API (stable ABI), and were not documented. (Contributed by Victor Stinner in bpo-35713.)"
Sorry, something went wrong.
|
I have made the requested changes; please review again . |
Sorry, something went wrong.
|
Thanks for making the requested changes! @vstinner: please review the changes made to this pull request. |
Sorry, something went wrong.
vstinner
left a comment
There was a problem hiding this comment.
LGTM.
Sorry, something went wrong.
|
Thanks @nanjekyejoannah! It now looks better: remove the function rather than documenting it :-) I prefer to have a smaller C API! |
Sorry, something went wrong.
|
This breaks pybind 11. Opened an issue with them (pybind/pybind11#1932). Where this should be fixed is a bit over my head at the moment. |
Sorry, something went wrong.
Your gil_scoped_acquire class implementation is scary! Would you mind to open a new issue at bugs.python.org to describe your use case and ask to revert the change which removed PyThreadState_DeleteCurrent? |
Sorry, something went wrong.
|
Pybind11 supports some advanced GIL-related tricks that require access this function. For instance, pybind11 can intercept a Python function call on the Kind of crazy, but why is this useful? UI libraries. On some platforms, it is not legal to poll UI events on any thread other than the main thread. This means that it's impossible to implement a proper UI event loop because Python is hogging the main thread. With the functionality in pybind11's |
Sorry, something went wrong.
|
@vstinner: I provided some feedback on the Python bugtracker and here. |
Sorry, something went wrong.
Sorry, something went wrong.
|
I'm confused by the attached issue; it looks like the decision was to simply revert the change with the function moved, and not add the underscore; and maybe even make it slightly easier to use. Now that 3.9b1 is out, PyBind11-based libraries cannot build, and the only fix would be to start using a now internal function in CPython. SciPy is an example of a PyBind11-using library. |
Sorry, something went wrong.
|
PyThreadState_DeleteCurrent() is declared by the public C API, but it's now excluded from the limited C API. Does pybind11 uses the limited C API? What is your issue? Please comment https://bugs.python.org/issue37878 instead of this merged PR (if you have a bugs.python.org account). |
Sorry, something went wrong.
|
I'm sorry, I'll add a bugs.python.org account or see if I had one in the past if I need to comment there. I realize, from looking through the code, that an underscore was not added, the function was moved intact (which was not clear from the PR), exactly as it was supposed to be in the issue. The only remaining problem is that the release notes here are wrong: https://docs.python.org/3.9/whatsnew/3.9.html#removed (which is a much better problem). I'd love it if PyBind11 could use the limited API, but it can't. Thank you, @vstinner ! |
Sorry, something went wrong.
I created #20489 to update the What's New in Python 3.9 document. Would you mind to review my PR? |
Sorry, something went wrong.
Make
PyThreadState_DeleteCurrent()Internal.https://bugs.python.org/issue37878