This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: No type variables left in collections.abc.Callable
Type: crash Stage: resolved
Components: Versions: Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: kj, tyler.yep
Priority: normal Keywords:

Created on 2021-01-22 20:13 by tyler.yep, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (3)
msg385511 - (view) Author: Tyler Yep (tyler.yep) Date: 2021-01-22 20:13
The following code crashes when I try to run it, even though it passes when I use `from typing import Callable` instead.

```
from collections.abc import Callable
from typing import Any, TypeVar

V = TypeVar("V")
Function = Callable[[list[V], V, V], float]


def random_fn(fn: Function[Any]) -> Function[Any]:
    return fn
```
msg385521 - (view) Author: Ken Jin (kj) * (Python committer) Date: 2021-01-23 04:01
This seems to be a duplicate of Issue40494. It has already been fixed in Python 3.10, and in Python 3.9.2 (which isn't out yet). You can see the what's new for it here https://docs.python.org/3/whatsnew/3.9.html#notable-changes-in-python-3-9-2.

The expected release date for Python 3.9.2 is Monday, 2021-02-15 according to PEP 596 https://www.python.org/dev/peps/pep-0596/.

For now, I guess you'll have to use the old typing.Callable, then update it in newer versions of Python.

I'm assuming you are currently using python 3.9.0/3.9.1, which has this bug. I'm unable to reproduce it on Python 3.10.
msg385522 - (view) Author: Tyler Yep (tyler.yep) Date: 2021-01-23 04:12
Got it, thanks!
History
Date User Action Args
2022-04-11 14:59:40adminsetgithub: 87170
2021-01-23 04:12:23tyler.yepsetstatus: open -> closed
resolution: fixed
messages: + msg385522

stage: resolved
2021-01-23 04:01:46kjsetmessages: + msg385521
2021-01-22 23:19:42gvanrossumsetnosy: + kj
2021-01-22 20:13:42tyler.yepcreate