Author ncoghlan
Recipients Martin.Teichmann, Tim.Graham, eric.snow, gvanrossum, larry, ncoghlan, ned.deily, python-dev
Date 2016-12-03.06:45:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1480747519.13.0.0589364758026.issue23722@psf.upfronthosting.co.za>
In-reply-to
Content
Attached patch is some new test cases for an approach that I figured out *won't work*.

The problem I hit is that "__classcell__" is only injected into the class body execution namespace when there is at least one method implementation that needs it. In any other case, including when constructing types dynamically, it's entirely legitimate for it to be missing.

The attached draft test cases explored the idea of requiring that `__classcell__` be set to `None` to affirmatively indicate that it wasn't needed, but that would be a *major* compatibility break for dynamic type creation.

I haven't given up on providing that eager warning though - it should be possible to emit it in __build_class__ based on PyCell_GET returning NULL (as that should reliably indicate that type.__new__ never got access to the compiler provided cell object)
History
Date User Action Args
2016-12-03 06:45:19ncoghlansetrecipients: + ncoghlan, gvanrossum, larry, ned.deily, python-dev, eric.snow, Martin.Teichmann, Tim.Graham
2016-12-03 06:45:19ncoghlansetmessageid: <1480747519.13.0.0589364758026.issue23722@psf.upfronthosting.co.za>
2016-12-03 06:45:19ncoghlanlinkissue23722 messages
2016-12-03 06:45:18ncoghlancreate