[issue43355] __future__.annotations breaks inspect.signature()

2021-05-04 Thread Jelle Zijlstra
Jelle Zijlstra added the comment: Python 3.10 will add an eval_str= argument to inspect.signature() that lets you evaluate string annotations. I don't think it makes sense to change anything in the bugfix branches, so I propose that this issue be closed. -- nosy: +Jelle Zijlstra

[issue43355] __future__.annotations breaks inspect.signature()

2021-03-15 Thread Florian Bruhin
Change by Florian Bruhin : -- nosy: +The Compiler ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue43355] __future__.annotations breaks inspect.signature()

2021-03-05 Thread Terry J. Reedy
Terry J. Reedy added the comment: 3.7 only gets security fixes -- nosy: +terry.reedy versions: -Python 3.7 ___ Python tracker ___

[issue43355] __future__.annotations breaks inspect.signature()

2021-03-03 Thread Eric V. Smith
Eric V. Smith added the comment: I think this is all about: should inspect.signature() resolve string annotations into actual types (via get_type_hints, or whatever)? I don't use expect much, so I can't offer an opinion there. -- ___ Python

[issue43355] __future__.annotations breaks inspect.signature()

2021-03-03 Thread Eric Engestrom
Eric Engestrom added the comment: (... and I had the window open for too long and didn't notice Ken's reply before mine ^^') @kj: thanks for the workaround! it's good to be able to change our code and not have to depend on a yet-to-be-released patch on each python version :) That said,

[issue43355] __future__.annotations breaks inspect.signature()

2021-03-03 Thread Eric Engestrom
Eric Engestrom added the comment: Sorry, I just realized you asked for the "success" value as well. For python 3.7-3.9 without the `import annotations`, and for python 3.10, the type annotation is a class, ie. ``. -- ___ Python tracker

[issue43355] __future__.annotations breaks inspect.signature()

2021-03-03 Thread Ken Jin
Ken Jin added the comment: @eric.smith, here's a summarized version. I hope it helps: def foo(x: str) -> str: ... In Python 3.7 - 3.9 with from __future__ import annotations, inspect.signature sees foo's parameter as: Without the future import (and also in Python 3.10): The reason for

[issue43355] __future__.annotations breaks inspect.signature()

2021-03-03 Thread Eric Engestrom
Eric Engestrom added the comment: Sure thing. Putting the reproducing code in `test_foo.py` and running `docker run --rm -it -v $PWD:/code python sh -c 'pip install pytest && pytest -vvv /code/test_foo.py'` yields: ``` Collecting pytest Downloading pytest-6.2.2-py3-none-any.whl (280 kB)

[issue43355] __future__.annotations breaks inspect.signature()

2021-03-02 Thread Eric V. Smith
Eric V. Smith added the comment: Can you show the values of “expected” and “actual” for both the failures and successes? -- nosy: +eric.smith ___ Python tracker ___

[issue43355] __future__.annotations breaks inspect.signature()

2021-03-01 Thread Eric Engestrom
New submission from Eric Engestrom : We have a pytest that boils down to the following: ``` #from __future__ import annotations from inspect import Parameter, signature def foo(x: str) -> str: return x + x def test_foo(): expected = ( Parameter("x",