]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-42195: Override _CallableGenericAlias's __getitem__ (GH-23915)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 24 Dec 2020 03:07:51 +0000 (19:07 -0800)
committerGitHub <noreply@github.com>
Thu, 24 Dec 2020 03:07:51 +0000 (19:07 -0800)
commita1251980d20ee8aab8d887fc0d30a726247327af
treed1885fd2e81eda220071923729abf6a2274322ce
parent1e1bacf9e61143e7b0f78de9dcb578983bea8f81
bpo-42195: Override _CallableGenericAlias's __getitem__ (GH-23915)

Added `__getitem__` for `_CallableGenericAlias` so that it returns a subclass (itself) of `types.GenericAlias` rather than the default behavior of returning a plain `types.GenericAlias`. This fixes `repr` issues occuring after `TypeVar` substitution arising from the previous behavior.
(cherry picked from commit 6dd3da3cf4a0d6cb62d9c2a155434c127183454d)

Co-authored-by: kj <28750310+Fidget-Spinner@users.noreply.github.com>
Lib/_collections_abc.py
Lib/test/test_genericalias.py