[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Python-Dev] PEP 590 discussion

>> In one of the ways to call C functions in PEP 580, the function gets
>> access to:
>> - the arguments,
>> - "self", the object
>> - the class that the method was found in (which is not necessarily
>> type(self))
>> I still have to read the details, but when combined with
>> LOAD_METHOD/CALL_METHOD optimization (avoiding creation of a "bound
>> method" object), it seems impossible to do this efficiently with just
>> the callable's code and callable's object.
> It is possible, and relatively straightforward.

Access to the class isn't possible currently and also not with PEP 590. 
But it's easy enough to fix that: PEP 573 adds a new METH_METHOD flag to 
change the signature of the C function (not the vectorcall wrapper). PEP 
580 supports this "out of the box" because I'm reusing the class also to 
do type checks. But this shouldn't be an argument for or against either PEP.