[issue45489] ForwardRef does not support | operator

Bobbey Reese report at bugs.python.org
Fri Oct 15 12:37:31 EDT 2021


New submission from Bobbey Reese <bobbeyreese at gmail.com>:

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 information.
>>> from typing import ForwardRef
>>> ForwardRef('asdf') | ForwardRef('fdsa')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for |: 'ForwardRef' and 'ForwardRef'
>>> int | str
int | str
>>>

----------
messages: 404037
nosy: bobbeyreese
priority: normal
severity: normal
status: open
title: ForwardRef does not support | operator
type: behavior
versions: Python 3.10

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45489>
_______________________________________


More information about the Python-bugs-list mailing list