Author scoder
Recipients Matthias Braun, gvanrossum, petr.viktorin, scoder
Date 2020-06-21.20:55:07
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
This SO answer by Martijn Pieters explains the background:

and links to the original python-dev discussion:

The current implementation checks that the function being called is the one defined in the first non-heap type up the hierarchy. As long as heap types are only Python types, this is the first builtin/native/C-implemented (super)type. With extension types as heap types, however, it's no longer necessarily the type that defines the correct slot function.

IMHO, Greg Ewing gives the right direction here:

> Providing some way for objects to prevent superclass
> methods from being called on them when they're not looking

So, I think we should do something like walking up the hierarchy to find the C function in it that is currently being called, and then check if it's the one we would expect or if a subclass defines a different one. The current check does not bother to search and just assumes that it knows which (super)type defines the right function to call.
Date User Action Args
2020-06-21 20:55:07scodersetrecipients: + scoder, gvanrossum, petr.viktorin, Matthias Braun
2020-06-21 20:55:07scodersetmessageid: <>
2020-06-21 20:55:07scoderlinkissue39960 messages
2020-06-21 20:55:07scodercreate