]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-42195: Disallow isinstance/issubclass for subclasses of genericaliases in Union...
authorKen Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Sat, 2 Jan 2021 16:19:15 +0000 (00:19 +0800)
committerGitHub <noreply@github.com>
Sat, 2 Jan 2021 16:19:15 +0000 (08:19 -0800)
commit49cd68fb1ed4cbaf109308c0a7c8c1efcf6f3775
tree4a32be22ada611677a3d9f86b5c1e1215aac3dcd
parentd9142831ba6780eef47bb68e878cf2f8910c4ab2
bpo-42195: Disallow isinstance/issubclass for subclasses of genericaliases in Union (GH-24059)

Previously this didn't raise an error. Now it will:
```python
from collections.abc import Callable
isinstance(int, list | Callable[..., str])
```
Also added tests in Union since there were previously none for stuff like ``isinstance(list, list | list[int])`` either.

Backport to 3.9 not required.

Automerge-Triggered-By: GH:gvanrossum
Lib/test/test_types.py
Objects/unionobject.c