Message385541
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. |
|
Date |
User |
Action |
Args |
2021-01-23 15:40:55 | kj | set | recipients:
+ kj, gvanrossum, Zac Hatfield-Dodds, BTaskaya |
2021-01-23 15:40:55 | kj | set | messageid: <1611416455.76.0.903607091686.issue43006@roundup.psfhosted.org> |
2021-01-23 15:40:55 | kj | link | issue43006 messages |
2021-01-23 15:40:55 | kj | create | |
|