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 kj
Recipients BTaskaya, Zac Hatfield-Dodds, gvanrossum, kj
Date 2021-01-23.15:40:55
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1611416455.76.0.903607091686.issue43006@roundup.psfhosted.org>
In-reply-to
Content
For anyone interested, I went to do some digging on the 3 issues Zac listed:

1. Similar to the first message, this is caused by inspect.getfullarg/signature using get_type_hints in Py 3.10. get_type_hints internally converts None to NoneType.

2. I don't know what's causing that TypeDict signature to fail.

3. I'm not too sure, but maybe this is intentional according to https://www.python.org/dev/peps/pep-0563/#keeping-the-ability-to-use-function-local-state-when-defining-annotations ? You can fix it by passing in locals() to get_type_hints (this should work all the way back to 3.6)::

import typing

def f():
    A = typing.TypeVar("A")
    def same_type_args(a: A, b: A):
        assert type(a) == type(b)
    print(typing.get_type_hints(same_type_args, localns=locals()))

>>> f()
{'a': ~A, 'b': ~A}

The whatsnew should probably be updated to mention this, this is a backwards incompatible change after all.
History
Date User Action Args
2021-01-23 15:40:55kjsetrecipients: + kj, gvanrossum, Zac Hatfield-Dodds, BTaskaya
2021-01-23 15:40:55kjsetmessageid: <1611416455.76.0.903607091686.issue43006@roundup.psfhosted.org>
2021-01-23 15:40:55kjlinkissue43006 messages
2021-01-23 15:40:55kjcreate