Ken Jin <kenjin4...@gmail.com> added the comment:

@Florian,

IIUC inspect.signature auto-resolves string annotations to typing.ForwardRef 
internally from 3.10 onwards. It's mentioned in the what's new for PEP 563 
https://docs.python.org/3.10/whatsnew/3.10.html#pep-563-postponed-evaluation-of-annotations-becomes-default

If it fails, it will just give the string. So the only place where 
inspect.signature might start giving you different output is if you previously 
defined a function like so:

def foo(a: 'MyType'): ...

And you expected inspect.signature.paramters to be ``[<Parameter "a: 
'MyType'">]`` (the string). However if MyType is in globals()/locals(), you'll 
instead get ``[<Parameter "a: MyType">]`` in 3.10.

FWIW someone already reported that in Issue43355.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue43463>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to