New submission from Ofek Lev <ofekmeis...@gmail.com>:
https://docs.python.org/3.9/library/typing.html#callable ``` Python 3.9.1 (default, Jan 12 2021, 16:45:25) [GCC 8.3.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> from typing import Optional >>> from collections.abc import Callable >>> >>> Hasher = Optional[Callable[[bytes], bytes]] Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python3.9/typing.py", line 262, in inner return func(*args, **kwds) File "/usr/local/lib/python3.9/typing.py", line 339, in __getitem__ return self._getitem(self, parameters) File "/usr/local/lib/python3.9/typing.py", line 463, in Optional return Union[arg, type(None)] File "/usr/local/lib/python3.9/typing.py", line 262, in inner return func(*args, **kwds) File "/usr/local/lib/python3.9/typing.py", line 339, in __getitem__ return self._getitem(self, parameters) File "/usr/local/lib/python3.9/typing.py", line 451, in Union parameters = _remove_dups_flatten(parameters) File "/usr/local/lib/python3.9/typing.py", line 231, in _remove_dups_flatten return tuple(_deduplicate(params)) File "/usr/local/lib/python3.9/typing.py", line 205, in _deduplicate all_params = set(params) TypeError: unhashable type: 'list' >>> >>> from typing import Tuple >>> Hasher = Optional[Callable[Tuple[bytes], bytes]] >>> ``` Tuple type for arguments makes it work ---------- components: Library (Lib) messages: 385246 nosy: Ofekmeister priority: normal severity: normal status: open title: Optional callable raises TypeError type: behavior versions: Python 3.9 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue42965> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com