[issue33179] Investigate using a context variable for zero-arg super initialisation

2018-03-29 Thread Yury Selivanov
Yury Selivanov added the comment: > Even without context chaining, it seems to me that nesting of class > definitions could be handled by making the context variable a list of cell > objects and having type.__new__ look at the final entry rather than the whole > thing. Hum, yeah, this might

[issue33179] Investigate using a context variable for zero-arg super initialisation

2018-03-29 Thread Nick Coghlan
Nick Coghlan added the comment: Note that this isn't about the __class__ reference itself - that would still be a closure cell. This issue is about the fact that since Python 3.6, type.__new__ has handled calling __set_name__ on all the descriptors, so __build_class__ needs a way to pass the

[issue33179] Investigate using a context variable for zero-arg super initialisation

2018-03-29 Thread Yury Selivanov
Yury Selivanov added the comment: This would work only if we had chained contexts from PEP 550. With PEP 567, swapping the current Context in boundmethods would cause all methods to lose the context that the user wanted them to run in. -- ___ Pyth

[issue33179] Investigate using a context variable for zero-arg super initialisation

2018-03-29 Thread Nick Coghlan
New submission from Nick Coghlan : As noted in https://docs.python.org/3/reference/datamodel.html?#creating-the-class-object, implementing PEP 487 required the introduction of __classcell__ as a way for __build_class__ to pass the zero-arg super() cell object through to type.__new__. Now tha