-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Improve the error reporting for inc_ref GIL failures #4427
Improve the error reporting for inc_ref GIL failures #4427
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 |
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.
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: