[Python-Dev] PEP 573 -- Module State Access from C Extension Methods
Jeroen Demeyer
J.Demeyer at UGent.be
Mon Apr 23 14:04:27 EDT 2018
Hello,
I just saw this PEP. There is a bit of overlap between PEP 573 and PEP
575 since these both change the calling convention for built-in methods.
In particular, PEP 575 also proposes to add a "defining class" member
(for different reasons). In PEP 575, this is added to the PyCFunction
struct itself instead of a separate struct PyCMethod.
It would be nice to justify whether you really need a new class
(PyCMethod_Type) to support METH_METHOD. It looks strange to me that the
class of some object depends on an implementation detail like whether
METH_METHOD is specified.
The current PEP 573 implies that backwards compatibility concerns would
arise every time that METH_METHOD is added to an existing method. People
have asked questions on PEP 575 about that: it would break code
depending on "types.BuiltinFunctionType" for example. You could instead
just change PyCFunctionObject to add that field (that's what I did in
PEP 575).
For practical reasons, it would be nice to implement PEP 573 and PEP 575
together as they affect the same code (assuming that both PEPs are
accepted of course).
Jeroen.
More information about the Python-Dev
mailing list