]> granicus.if.org Git - python/commit
Anti-registration of various ABC methods.
authorGuido van Rossum <guido@dropbox.com>
Thu, 18 Aug 2016 16:22:23 +0000 (09:22 -0700)
committerGuido van Rossum <guido@dropbox.com>
Thu, 18 Aug 2016 16:22:23 +0000 (09:22 -0700)
commit97c1adf3935234da716d3289b85f72dcd67e90c2
tree0af6f9f258cf26ee9e59db463cc89d04c45bc0b8
parent0a6996d87d19a524c2a11dd315d96d12083c47d4
Anti-registration of various ABC methods.

- Issue #25958: Support "anti-registration" of special methods from
  various ABCs, like __hash__, __iter__ or __len__.  All these (and
  several more) can be set to None in an implementation class and the
  behavior will be as if the method is not defined at all.
  (Previously, this mechanism existed only for __hash__, to make
  mutable classes unhashable.)  Code contributed by Andrew Barnert and
  Ivan Levkivskyi.
15 files changed:
Doc/library/collections.abc.rst
Doc/reference/datamodel.rst
Lib/_collections_abc.py
Lib/test/test_augassign.py
Lib/test/test_binop.py
Lib/test/test_bool.py
Lib/test/test_bytes.py
Lib/test/test_collections.py
Lib/test/test_contains.py
Lib/test/test_enumerate.py
Lib/test/test_iter.py
Lib/test/test_unicode.py
Misc/NEWS
Objects/enumobject.c
Objects/typeobject.c