This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author TNThung
Recipients TNThung
Date 2021-11-21.14:48:31
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1637506111.5.0.826205176723.issue45857@roundup.psfhosted.org>
In-reply-to
Content
The class methods have a problem compiling when the type refers to the union of itself and others.


# tmp.py
class Foo:
    def __init__(self, tmp: "Foo"|int):
        pass


# Error
Traceback (most recent call last):
  File "/Project/Mslc/Grammar/tmp.py", line 1, in <module>
    class Foo:
  File "/Project/Mslc/Grammar/tmp.py", line 2, in Foo
    def __init__(self, tmp: "Foo"|int):
TypeError: unsupported operand type(s) for |: 'str' and 'type'
History
Date User Action Args
2021-11-21 14:48:31TNThungsetrecipients: + TNThung
2021-11-21 14:48:31TNThungsetmessageid: <1637506111.5.0.826205176723.issue45857@roundup.psfhosted.org>
2021-11-21 14:48:31TNThunglinkissue45857 messages
2021-11-21 14:48:31TNThungcreate