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

Import abstract base classes from collections.abc #867

Merged
merged 1 commit into from
Aug 7, 2018
Merged

Import abstract base classes from collections.abc #867

merged 1 commit into from
Aug 7, 2018

Conversation

The-Compiler
Copy link
Contributor

In Python 3.7, importing ABCs directly from the collections module shows a
warning (and in Python 3.8 it will stop working) - see
python/cpython@c66f9f8

This fixes various DeprecationWarnings such as those:

.../jinja2/utils.py:485: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
  from collections import MutableMapping

.../jinja2/runtime.py:318: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
  from collections import Mapping

from collections import Mapping
Mapping.register(Context)
except ImportError:
pass

This comment was marked as off-topic.

MutableMapping.register(LRUCache)
except ImportError:
pass
abc.MutableMapping.register(LRUCache)

This comment was marked as off-topic.

@The-Compiler
Copy link
Contributor Author

The Travis failure is unrelated, it happens because Python 3.3 got dropped in wheel (and probably elsewhere too).

In Python 3.7, importing ABCs directly from the `collections` module shows a
warning (and in Python 3.8 it will stop working) - see
python/cpython@c66f9f8

This fixes various DeprecationWarnings such as those:

```
.../jinja2/utils.py:485: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
  from collections import MutableMapping

.../jinja2/runtime.py:318: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
  from collections import Mapping
```
@reinout
Copy link

reinout commented Nov 21, 2018

Looking at the changelog: this fix doesn't seem to be released yet, right?
If so, will there be a release fairly soon? My project's pytest output is showing quite a number of these deprecation warnings :-)

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

Successfully merging this pull request may close these issues.

3 participants