[issue45489] ForwardRef does not support | operator

2021-10-16 Thread Ken Jin
Ken Jin added the comment: Thanks @corona10 for the patch. @bobbeyreese The new behavior is available in 3.11 and up. 3.10.x won't be supporting the | operator. -- resolution: -> fixed stage: -> resolved status: open -> closed versions: -Python 3.10 __

[issue45489] ForwardRef does not support | operator

2021-10-16 Thread Guido van Rossum
Guido van Rossum added the comment: No. :-) -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.

[issue45489] ForwardRef does not support | operator

2021-10-16 Thread Dong-hee Na
Dong-hee Na added the comment: @guido Do we need to create a backport for 3.10? Ken and I are waiting for your comment :) https://github.com/python/cpython/pull/28991#issuecomment-944926933 -- ___ Python tracker

[issue45489] ForwardRef does not support | operator

2021-10-16 Thread Dong-hee Na
Dong-hee Na added the comment: New changeset 15ad52fbf607b6ccec44a38a8a32a5f1fad635ee by Dong-hee Na in branch 'main': bpo-45489: Update ForwardRef to support | operator. (GH-28991) https://github.com/python/cpython/commit/15ad52fbf607b6ccec44a38a8a32a5f1fad635ee -- ___

[issue45489] ForwardRef does not support | operator

2021-10-16 Thread Ken Jin
Ken Jin added the comment: ForwardRef is for internal use, and writing ForwardRef('fdsa') is discouraged, as the docs say: This class should not be instantiated by a user. However, I don't see any cons from adding union support, so let's do it! Note that a workaround exists for OP's exam

[issue45489] ForwardRef does not support | operator

2021-10-16 Thread Dong-hee Na
Change by Dong-hee Na : -- keywords: +patch pull_requests: +27275 stage: -> patch review pull_request: https://github.com/python/cpython/pull/28991 ___ Python tracker ___

[issue45489] ForwardRef does not support | operator

2021-10-16 Thread Guido van Rossum
Guido van Rossum added the comment: I suppose this is useful for programs that use runtime annotations (e.g. pydantic?). I don’t mind adding this. -- ___ Python tracker ___ __

[issue45489] ForwardRef does not support | operator

2021-10-16 Thread Dong-hee Na
Change by Dong-hee Na : -- versions: +Python 3.11 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mai

[issue45489] ForwardRef does not support | operator

2021-10-16 Thread Dong-hee Na
Dong-hee Na added the comment: --- a/Lib/typing.py +++ b/Lib/typing.py @@ -719,6 +719,12 @@ def __eq__(self, other): def __hash__(self): return hash(self.__forward_arg__) +def __or__(self, other): +return Union[self, other] + +def __ror__(self, other): +re

[issue45489] ForwardRef does not support | operator

2021-10-16 Thread Dong-hee Na
Change by Dong-hee Na : -- nosy: +corona10 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pytho

[issue45489] ForwardRef does not support | operator

2021-10-16 Thread Terry J. Reedy
Change by Terry J. Reedy : -- nosy: +gvanrossum, kj ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://m

[issue45489] ForwardRef does not support | operator

2021-10-15 Thread Bobbey Reese
New submission from Bobbey Reese : Not positive this is a bug, but it seems like ForwardRef should support the pipe (|) operator for indicating Unions in Python 3.10: Python 3.10.0 (default, Oct 4 2021, 22:09:55) [GCC 9.3.0] on linux Type "help", "copyright", "credits" or "license" for more i