bpo-44232: Fix type_new crash caused by AssertionError#26358
bpo-44232: Fix type_new crash caused by AssertionError#26358Fidget-Spinner wants to merge 1 commit into
Conversation
|
I proposed a different fix in PR #PR 26359. I didn't notice that you was working on a fix in parallel :-) |
|
Why not keep the assertion but add a null check for the return value of Then you keep the invariant of "-1 means error, 0 means didn't assign to *type, 1 means assigned to *type" |
No worries. This is funny and slightly sad at the same time but I'm glad either way some kind of fix is going in. |
Oops our messages were posted at the same time and I missed yours. Sorry. @sweeneyde I considered that. But I chose to delete the assertion because that's the old behavior before the refactor (which caused this regression), and I didn't want to take any chances: ecf14e6#diff-1decebeef15f4e0b0ce106c665751ec55068d4d1d1825847925ad4f528b5b872L2464 Anyways, Victor's GH-26359 does what you're suggesting. So you can consider his PR instead. |
|
Victor's PR has been merged, so I'm closing this |
typecan sometimes be NULL due to invalidtp_newof base classes, so just returnNULLin those cases (the old code prior to refactoring in ecf14e6 did this).This only affects debug builds.
https://bugs.python.org/issue44232