[issue44632] Union with TypeVar does not work as intended

2021-07-15 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue44632] Union with TypeVar does not work as intended

2021-07-15 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset cc1a47c849a206441c9b370b6ca954862a523082 by Miss Islington (bot) in branch '3.10': bpo-44632: Fix support of TypeVar in the union type (GH-27139) (GH-27143) https://github.com/python/cpython/commit/cc1a47c849a206441c9b370b6ca954862a523082

[issue44632] Union with TypeVar does not work as intended

2021-07-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset a158b20019b50e3ece6e4743ec4e6ae8d818b690 by Serhiy Storchaka in branch 'main': bpo-44632: Fix support of TypeVar in the union type (GH-27139) https://github.com/python/cpython/commit/a158b20019b50e3ece6e4743ec4e6ae8d818b690 --

[issue44632] Union with TypeVar does not work as intended

2021-07-14 Thread miss-islington
Change by miss-islington : -- nosy: +miss-islington nosy_count: 3.0 -> 4.0 pull_requests: +25685 pull_request: https://github.com/python/cpython/pull/27143 ___ Python tracker

[issue44632] Union with TypeVar does not work as intended

2021-07-14 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- keywords: +patch pull_requests: +25681 stage: -> patch review pull_request: https://github.com/python/cpython/pull/27139 ___ Python tracker

[issue44632] Union with TypeVar does not work as intended

2021-07-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Good question. It works correctly in list[T]. There is a tiny difference between implementations of the check in genericaliasobject.c and unionobject.c. -- ___ Python tracker

[issue44632] Union with TypeVar does not work as intended

2021-07-14 Thread Ken Jin
Ken Jin added the comment: Oh this is a fun one :). > The code for recognizing TypeVars must be wrong. Is it also wrong in e.g. > list[T]? list[T] is correct. I was pretty puzzled since I thought their code is nearly the same, but then I noticed a subtle difference -- GenericAlias checks

[issue44632] Union with TypeVar does not work as intended

2021-07-14 Thread Guido van Rossum
Guido van Rossum added the comment: The code for recognizing TypeVars must be wrong. Is it also wrong in e.g. list[T]? -- ___ Python tracker ___

[issue44632] Union with TypeVar does not work as intended

2021-07-13 Thread Serhiy Storchaka
New submission from Serhiy Storchaka : >>> import typing >>> int | typing.T int | ~T >>> typing.T | int typing.Union[~T, int] >>> T2 = TypeVar('T2') >>> int | T2 typing.Union[int, ~T2] >>> T2 | int typing.Union[~T2, int] There is a support of TypeVar in type.__or__, but it does not work with