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

fix: compatible with python3.8 #234

Merged
merged 1 commit into from
Sep 18, 2020
Merged

Conversation

aisk
Copy link
Contributor

@aisk aisk commented Sep 9, 2020

Since abc is a submodule in collections and not imported to collections, directly using collections.abc.MutableSequence will cause error in newer versions (I tested it on 3.8.5, but I think 3.7 may have the same issue):

>>> import collections
>>> collections.abc.MutableSequence
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/anlong/.homebrew/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/collections/__init__.py", line 55, in __getattr__
    raise AttributeError(f'module {__name__!r} has no attribute {name!r}')
AttributeError: module 'collections' has no attribute 'abc'

And the current code will cause this error: python -c "from pydruid import client".

I think this issue was not found because if we run import collections.abc or from collections.abc import x before, the collections.abc will be added to collections. And many thrid party have codes like this.

But anyway, I think we should fix this.

@aisk
Copy link
Contributor Author

aisk commented Sep 9, 2020

I think pytest may hide this issue so we don't found it: https://stackoverflow.com/questions/52798967/why-can-i-access-collections-abc-in-tests-but-not-in-production .

@lokkju
Copy link
Contributor

lokkju commented Sep 18, 2020

Bumping, this is a PITA right now

@lokkju
Copy link
Contributor

lokkju commented Sep 18, 2020

Also, this was previously discussed in #169 but wasn't correctly resolved.

@mistercrunch mistercrunch merged commit f674b69 into druid-io:master Sep 18, 2020
@aisk aisk deleted the patch-1 branch September 18, 2020 04:41
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

Successfully merging this pull request may close these issues.

None yet

3 participants