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 DeprecationWarning when accessing collections.abc classes via collections #6268

Merged
merged 2 commits into from Feb 25, 2019

Conversation

Projects
None yet
4 participants
@chornsby
Copy link
Contributor

chornsby commented Oct 20, 2018

Description

Since the Mapping and MutableMapping classes will no longer be available to import directly from the collections module in Python 3.8, we should create and use aliases for them in the compat module. I noticed this due to deprecation warnings appearing in tests in a project using rest framework that I ran on Python 3.7.

This builds on the work started in #6154 and removes the remaining references to the abstract base classes that are used in the project.

chornsby added some commits Oct 20, 2018

Use compat version of collections.abc.Mapping
Since the Mapping class will no longer be available to import directly
from the collections module in Python 3.8, we should use the
compatibility helper introduced in #6154 in the fields module.
Alias and use compat version of collections.abc.MutableMapping
Since the MutableMapping class will no longer be available to import
directly from the collections module in Python 3.8, we should create an
alias for it in the compat module and use that instead.

@chornsby chornsby changed the title Py38 compat abc Fix DeprecationWarning when accessing collections.abc classes via collections Oct 20, 2018

@tirkarthi

This comment has been minimized.

Copy link
Contributor

tirkarthi commented Jan 13, 2019

There could be warnings caused in below files as I can see from grep

tests/test_renderers.py
5:from collections import MutableMapping, OrderedDict

tests/test_serializer.py
8:from collections import Mapping

@carltongibson carltongibson added this to the 3.9.2 Release milestone Feb 19, 2019

@carltongibson
Copy link
Collaborator

carltongibson left a comment

Great. Thanks.

@carltongibson carltongibson merged commit 07c5c96 into encode:master Feb 25, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@chornsby chornsby deleted the chornsby:py38-compat-abc branch Feb 25, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.