[issue43006] Changed behaviour of inspect.signature() in Python 3.10
Zac Hatfield-Dodds
report at bugs.python.org
Sat Jan 23 08:45:35 EST 2021
Zac Hatfield-Dodds <zac.hatfield.dodds at gmail.com> added the comment:
And I promise this is the last one:
import inspect
import typing
def f():
A = typing.TypeVar("A")
def same_type_args(a: A, b: A):
assert type(a) == type(b)
print(inspect.signature(same_type_args))
print(typing.get_type_hints(same_type_args))
f()
$ python3 t.py
(a: ~A, b: ~A)
{'a': ~A, 'b': ~A}
$ python3.10 t.py
(a: 'A', b: 'A')
Traceback (most recent call last):
...
NameError: name 'A' is not defined
My apologies to everyone involved here; I'm looking forward to postponed annotation evaluation, appreciate all your work on this, and regret that I have such bizzare bugs to report <3
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43006>
_______________________________________
More information about the Python-bugs-list
mailing list