Message 413586 - Python tracker

Message413586

Author kgubaev
Recipients kgubaev, lys.nikolaou, pablogsal
Date 2022-02-20.13:05:31
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1645362331.92.0.497127869678.issue46807@roundup.psfhosted.org>
In-reply-to
Content
In [18]: class Str(str):
    ...:     pass

In [19]: class Class:
    ...:     Str: str
    ...: 
    ...: 
    ...: Class.__annotations__
Out[19]: {'Str': str}

In [20]: class Class:
    ...:     Str: str = ""
    ...: 
    ...: 
    ...: Class.__annotations__
Out[20]: {'Str': str}

In [21]: class Class:
    ...:     Str: Str = ""
    ...: 
    ...: 
    ...: Class.__annotations__      # Wrong!
Out[21]: {'Str': ''}

In [22]: class Class:
    ...:     Str: Str
    ...: 
    ...: 
    ...: Class.__annotations__
Out[22]: {'Str': __main__.Str}

It reproduced all the version which support annotations as part of the core (I tested python 3.6..3.10.2)
History
Date User Action Args
2022-02-20 13:05:31kgubaevsetrecipients: + kgubaev, lys.nikolaou, pablogsal
2022-02-20 13:05:31kgubaevsetmessageid: <1645362331.92.0.497127869678.issue46807@roundup.psfhosted.org>
2022-02-20 13:05:31kgubaevlinkissue46807 messages
2022-02-20 13:05:31kgubaevcreate