Message388751
@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. |
|
Date |
User |
Action |
Args |
2021-03-15 17:28:53 | kj | set | recipients:
+ kj, gvanrossum, eric.smith, The Compiler, levkivskyi |
2021-03-15 17:28:53 | kj | set | messageid: <1615829333.49.0.966713819377.issue43463@roundup.psfhosted.org> |
2021-03-15 17:28:53 | kj | link | issue43463 messages |
2021-03-15 17:28:53 | kj | create | |
|