]> granicus.if.org Git - python/commit
Issue #23722: improve __classcell__ compatibility
authorNick Coghlan <ncoghlan@gmail.com>
Mon, 5 Dec 2016 06:47:55 +0000 (16:47 +1000)
committerNick Coghlan <ncoghlan@gmail.com>
Mon, 5 Dec 2016 06:47:55 +0000 (16:47 +1000)
commit19d246745d9d013c12e9560dd020d778381780fb
treea296697991d1f411c3ee76690c6549985744e85a
parent71c62e14aa27d73623427a0a626b1f20df309e43
Issue #23722: improve __classcell__ compatibility

Handling zero-argument super() in __init_subclass__ and
__set_name__ involved moving __class__ initialisation to
type.__new__. This requires cooperation from custom
metaclasses to ensure that the new __classcell__ entry
is passed along appropriately.

The initial implementation of that change resulted in abruptly
broken zero-argument super() support in metaclasses that didn't
adhere to the new requirements (such as Django's metaclass for
Model definitions).

The updated approach adopted here instead emits a deprecation
warning for those cases, and makes them work the same way they
did in Python 3.5.

This patch also improves the related class machinery documentation
to cover these details and to include more reader-friendly
cross-references and index entries.
Doc/reference/datamodel.rst
Doc/whatsnew/3.6.rst
Lib/importlib/_bootstrap_external.py
Lib/test/test_super.py
Misc/NEWS
Objects/typeobject.c
Python/bltinmodule.c
Python/compile.c
Python/importlib_external.h