Improve the error reporting for inc_ref GIL failures#4427
Improve the error reporting for inc_ref GIL failures#4427henryiii merged 5 commits intopybind:masterfrom
Conversation
|
@Skylion007 @henryiii I know this sucks, but I think you might want to push this out ASAP given all the issues with 2.10.2 Might be worth rereleasing 2.10.2 with this patch or pushing out 2.10.3 |
rwgk
left a comment
There was a problem hiding this comment.
Sorry a lot of comments, but really only about details. The general approach is great! Thanks again for jumping in making this better.
|
I don't remember seeing the pypy-3.7 • windows-2022 • x64 CI failure. Rerunning to be sure it's a flake. |
|
I believe all of the comments are now resolved. Thanks for the feedback and reviews! |
|
Could someone else please merge this? (@henryiii or @Skylion007) |
…pointer. Context: * pybind/pybind11#4427 (comment) > I don't think your logic ... is actually correct? I don't think it would handle metaclasses right. PiperOrigin-RevId: 498690703
* First * Fixs * Improve * Additional assertions comment * Improve docs
Description
In 2.10.2, we added a new feature to catch UB when inc_ref or dec_ref are called without the GIL. This functionality works great, but the error reporting via an exception is very suboptimal as those exceptions get called in weird environments, triggering weird crashes.
This PR adds some good old-fashioned fprintf statements to help users understand what is going on. I want to use fprintf here because that's generally the most reliable method in all sorts of environments (especially when iostream might not be initialized properly).
Closes #4426
Suggested changelog entry: