diff options
author | Nick Coghlan <ncoghlan@gmail.com> | 2016-12-05 06:47:55 (GMT) |
---|---|---|
committer | Nick Coghlan <ncoghlan@gmail.com> | 2016-12-05 06:47:55 (GMT) |
commit | 19d246745d9d013c12e9560dd020d778381780fb (patch) | |
tree | a296697991d1f411c3ee76690c6549985744e85a /Misc | |
parent | 71c62e14aa27d73623427a0a626b1f20df309e43 (diff) | |
download | cpython-19d246745d9d013c12e9560dd020d778381780fb.zip cpython-19d246745d9d013c12e9560dd020d778381780fb.tar.gz cpython-19d246745d9d013c12e9560dd020d778381780fb.tar.bz2 |
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.
Diffstat (limited to 'Misc')
-rw-r--r-- | Misc/NEWS | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -10,6 +10,11 @@ What's New in Python 3.6.0 release candidate 1 Core and Builtins ----------------- +- Issue #23722: Rather than silently producing a class that doesn't support + zero-argument ``super()`` in methods, failing to pass the new + ``__classcell__`` namespace entry up to ``type.__new__`` now results in a + ``DeprecationWarning`` and a class that supports zero-argument ``super()``. + - Issue #28797: Modifying the class __dict__ inside the __set_name__ method of a descriptor that is used inside that class no longer prevents calling the __set_name__ method of other descriptors. @@ -31,6 +36,13 @@ Library - Issue #28843: Fix asyncio C Task to handle exceptions __traceback__. +Documentation +------------- + +- Issue #23722: The data model reference and the porting section in the What's + New guide now cover the additional ``__classcell__`` handling needed for + custom metaclasses to fully support PEP 487 and zero-argument ``super()``. + Tools/Demos ----------- |