Closed
Description
Bug report
typing.get_type_hints()
works for Callable[[], None]
from the typing
module, but not collections.abc
. This is the standard way to annotate a callable which takes no arguments, and the generic types from typing
should behave identically to those in collections.abc
.
import collections.abc
import typing
def f1(x: typing.Callable[[], None]):
pass
def f2(x: collections.abc.Callable[[], None]):
pass
assert "x" in typing.get_type_hints(f1)
typing.get_type_hints(f2) # Raises TypeError!
Your environment
CPython 3.11.0a7 (and I believe back to a3), found via CI for Hypothesis, and reproduced in Ubuntu/WSL2 locally.
I'm skipping that test for now, and will re-enable when this is fixed.