On 2020-01-03 14:36, Petr Viktorin wrote:
On 2019-11-25 13:15, Stefan Behnel wrote:
I think that PEP 573 is ready to be accepted, to greatly improve the state of extension modules in CPython 3.9.
It has come a long way since the original proposal and went through several iterations and discussions by various interested people, effectively reducing its scope quite a bit. So this is the last call for comments on the latest version of the PEP, before I will pronounce on it. Please keep the discussion in this thread.
I have received substantial private feedback, and I'll need to make another update to:
## Better separate C-API additions:[...] from CPython implementation details:
## Clarify that ht_module is not inherited
## Specify what "defining class" means more rigorously
The update is here: https://github.com/python/peps/pull/1275
It also includes a more drastic change: it removes the MRO walker from the proposal. Reflecting on the feedback, it became clear to me that a MRO walker, as it was described, won't give correct results in all cases: specifically, is a slot is overridden by setting a special method from Python code, the walker won't be able to find module. Think something like: c_add = Class.__add__ # where nb_add uses the MRO walker Class.__add__ = lambda *args: "evil" c_add(Class(), 0) # Exception: Defining type has not been found.
This can be solved, but it will need a different design and more discussion. I'd rather defer it to the future. Meanwhile, extension authors can use their own MRO walker if they're OK with some surprising edge cases.