Nick Coghlan added the comment:

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.

----------
nosy: +larry
priority: normal -> release blocker
resolution: fixed -> 
stage: resolved -> needs patch
status: closed -> open

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue23722>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to