-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
bpo-35983: improve and test old trashcan macros #12607
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
Conversation
|
You need to merge/rebase and fix conflicts now. |
|
|
Done |
|
I'm not sure it's safe to change the meaning of the old macros. @benjaminp @serhiy-storchaka What do you think? |
They are already changed as part of #11841. This is just changing them in a safer way. |
|
AFAICT, |
|
I see what you mean. Let me be very precise what this PR will fix and what it will break, hopefully clarifying things: This will fix a crash in this case:
This will add a new crash in this case:
I consider the first set of conditions more likely than the second, so this will fix more crashes than it introduces. But I cannot deny the possibility that it will break stuff. |
This is a follow-up to #11841. I made a separate PR since that one has been reviewed already.
I realized that the backwards-compatibility macros
Py_TRASHCAN_SAFE_BEGIN(op)can be made safe by only using the trashcan if the class inherits directly fromobject. That case is safe and it's also a very common case (few builtin types have a non-trivial subtype).https://bugs.python.org/issue35983