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 Hashable from collections.abc #181

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGES
Expand Up @@ -4,6 +4,12 @@ For a complete changelog, see:
* https://github.com/yaml/pyyaml/commits/
* https://bitbucket.org/xi/pyyaml/commits/

4.2 (unreleased)
----------------

* Fixed deprecation warning on Python 3.7 by importing from collections.abc
instead of collections.

4.1 (2018-06-26)
----------------

Expand Down
4 changes: 2 additions & 2 deletions lib3/yaml/constructor.py
Expand Up @@ -5,7 +5,7 @@
from .error import *
from .nodes import *

import collections, datetime, base64, binascii, re, sys, types
import collections.abc, datetime, base64, binascii, re, sys, types

class ConstructorError(MarkedYAMLError):
pass
Expand Down Expand Up @@ -123,7 +123,7 @@ def construct_mapping(self, node, deep=False):
mapping = {}
for key_node, value_node in node.value:
key = self.construct_object(key_node, deep=deep)
if not isinstance(key, collections.Hashable):
if not isinstance(key, collections.abc.Hashable):
raise ConstructorError("while constructing a mapping", node.start_mark,
"found unhashable key", key_node.start_mark)
value = self.construct_object(value_node, deep=deep)
Expand Down