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

Incorrect collections imports in type_util.py #118

Open
jolaf opened this issue Jul 5, 2022 · 1 comment
Open

Incorrect collections imports in type_util.py #118

jolaf opened this issue Jul 5, 2022 · 1 comment

Comments

@jolaf
Copy link

jolaf commented Jul 5, 2022

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'
@Stewori
Copy link
Owner

Stewori commented Jul 5, 2022

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 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants