Repository navigation
gh-159739: Keep the instance type alive during ABC subclass checks - #160198
JelleZijlstra merged 1 commit into
Conversation
When an instance advertises a __class__ different from its actual type, ABCMeta.__instancecheck__ performs two subclass checks. The first callback can change the instance's actual type and allow its old type to be collected before the second check, causing a crash. Keep the original type alive through both checks. Backport to 3.15 and 3.14.
|
Thanks @jelle-openai for the PR, and @JelleZijlstra for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14. |
|
Thanks @jelle-openai for the PR, and @JelleZijlstra for merging it 🌮🎉.. I'm working now to backport this PR to: 3.15. |
|
Thanks @jelle-openai for the PR, and @JelleZijlstra for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14, 3.15. |
|
Sorry, @jelle-openai and @JelleZijlstra, I could not cleanly backport this to Please backport manually with cherry_picker, see the devguide for more information. |
|
Sorry, @jelle-openai and @JelleZijlstra, I could not cleanly backport this to Please backport manually with cherry_picker, see the devguide for more information. |
1 similar comment
|
Sorry, @jelle-openai and @JelleZijlstra, I could not cleanly backport this to Please backport manually with cherry_picker, see the devguide for more information. |
|
Sorry, @jelle-openai and @JelleZijlstra, I could not cleanly backport this to Please backport manually with cherry_picker, see the devguide for more information. |
When an instance advertises a
__class__different from its actual type,ABCMeta.__instancecheck__performs two subclass checks. The first callback can change the instance's actual type and allow its old type to be collected before the second check, causing a crash. Keep the original type alive through both checks. Backport to 3.15 and 3.14.