Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No type variables left in collections.abc.Callable #87170

Closed
tyleryep mannequin opened this issue Jan 22, 2021 · 3 comments
Closed

No type variables left in collections.abc.Callable #87170

tyleryep mannequin opened this issue Jan 22, 2021 · 3 comments
Labels
3.9 only security fixes type-crash A hard crash of the interpreter, possibly with a core dump

Comments

@tyleryep
Copy link
Mannequin

tyleryep mannequin commented Jan 22, 2021

BPO 43004
Nosy @Fidget-Spinner

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2021-01-23.04:12:23.972>
created_at = <Date 2021-01-22.20:13:42.344>
labels = ['3.9', 'type-crash']
title = 'No type variables left in collections.abc.Callable'
updated_at = <Date 2021-01-23.04:12:23.971>
user = 'https://bugs.python.org/tyleryep'

bugs.python.org fields:

activity = <Date 2021-01-23.04:12:23.971>
actor = 'tyler.yep'
assignee = 'none'
closed = True
closed_date = <Date 2021-01-23.04:12:23.972>
closer = 'tyler.yep'
components = []
creation = <Date 2021-01-22.20:13:42.344>
creator = 'tyler.yep'
dependencies = []
files = []
hgrepos = []
issue_num = 43004
keywords = []
message_count = 3.0
messages = ['385511', '385521', '385522']
nosy_count = 2.0
nosy_names = ['kj', 'tyler.yep']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'crash'
url = 'https://bugs.python.org/issue43004'
versions = ['Python 3.9']

@tyleryep
Copy link
Mannequin Author

tyleryep mannequin commented Jan 22, 2021

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

@tyleryep tyleryep mannequin added 3.9 only security fixes type-crash A hard crash of the interpreter, possibly with a core dump labels Jan 22, 2021
@Fidget-Spinner
Copy link
Member

This seems to be a duplicate of bpo-40494. 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.

@tyleryep
Copy link
Mannequin Author

tyleryep mannequin commented Jan 23, 2021

Got it, thanks!

@tyleryep tyleryep mannequin closed this as completed Jan 23, 2021
@tyleryep tyleryep mannequin closed this as completed Jan 23, 2021
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.9 only security fixes type-crash A hard crash of the interpreter, possibly with a core dump
Projects
None yet
Development

No branches or pull requests

1 participant