]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-44606: Fix __instancecheck__ and __subclasscheck__ for the union type. (GH-27120)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 14 Jul 2021 04:55:45 +0000 (21:55 -0700)
committerGitHub <noreply@github.com>
Wed, 14 Jul 2021 04:55:45 +0000 (21:55 -0700)
commitb42eee78e7651693aa38c390f577e5d499dcf55d
treee62a9959655eea8d452340750a1f3fbbfb2ba021
parentbb260c2a212aee2a7d7a32bf5208fd554bf72713
bpo-44606: Fix __instancecheck__ and __subclasscheck__ for the union type. (GH-27120)

* Fix issubclass() for None.
  E.g. issubclass(type(None), int | None) returns now True.
* Fix issubclass() for virtual subclasses.
  E.g. issubclass(dict, int | collections.abc.Mapping) returns now True.
* Fix crash in isinstance() if the check for one of items raises exception.
(cherry picked from commit 81989058de381108dfd0a4255b93d4fb34417002)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Lib/test/test_types.py
Misc/NEWS.d/next/Core and Builtins/2021-07-13-20-22-12.bpo-44606.S3Bv2w.rst [new file with mode: 0644]
Objects/unionobject.c