bpo-35983: improve and test old trashcan macros#12607
bpo-35983: improve and test old trashcan macros#12607jdemeyer wants to merge 1 commit intopython:mainfrom
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