pytypes
pytypes copied to clipboard
Incorrect collections imports in type_util.py
type_util.py references collections.Iterable and collections.Iterator which is incorrect, it should be collections.abc.Iterable and collections.abc.Iterator.
It causes actual crashes like this:
Traceback (most recent call last):
...
import pytypes
File "/home/buildmaster/.local/lib/python3.10/site-packages/pytypes/__init__.py", line 314, in <module>
from .typechecker import _install_import_hook
File "/home/buildmaster/.local/lib/python3.10/site-packages/pytypes/typechecker.py", line 35, in <module>
from .type_util import type_str, has_type_hints, _has_type_hints, is_builtin_type, \
File "/home/buildmaster/.local/lib/python3.10/site-packages/pytypes/type_util.py", line 2252, in <module>
class _typechecked_Iterable(collections.Iterable):
AttributeError: module 'collections' has no attribute 'Iterable'
It looks like this issue was introduced by Python 3.10 which dropped some aliases. It would be trivial to fix this particular issue, but be aware that pytypes would still be far from supporting Python 3.9 or 3.10. AFAIK the changes in typing from 3.8 to 3.9 are significant and would require half a rewrite of pytypes to support, see #116 .