Message282246
| Author |
ncoghlan |
| Recipients |
Martin.Teichmann, Tim.Graham, eric.snow, gvanrossum, larry, ncoghlan, ned.deily, python-dev |
| Date |
2016年12月02日.15:46:44 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1480693604.39.0.260860774044.issue23722@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
This step here is likely to be causing you problems:
https://github.com/django/django/blob/6d1394182d8c4c02598e0cf47f42a5e86706411f/django/db/models/base.py#L90
Because the original class namespace isn't being passed up to type.__new__, it isn't seeing the `__classcell__` reference it needs in order to populate the automatic reference correctly. Copying that over the same way you're already copying `__module__` should get things working again with 3.6.0b4.
However, given that we have a least one in-the-wild example of this causing problems, I think the right thing to do on the CPython side is to restore the old behaviour where the cell reference is returned from the class creation closure, but issue a deprecation warning if it hasn't already been set by type.__new__.
We're also going to need to document `__classcell__`, as we didn't account for the type-subclass-passing-a-different-namespace-to-the-parent-method scenario when initially deciding we could treat it as a hidden implementation detail. |
|