diff --git a/CHANGES b/CHANGES index 8f220421..086918fb 100644 --- a/CHANGES +++ b/CHANGES @@ -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) ---------------- diff --git a/lib3/yaml/constructor.py b/lib3/yaml/constructor.py index 981543ae..193d91d9 100644 --- a/lib3/yaml/constructor.py +++ b/lib3/yaml/constructor.py @@ -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 @@ -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)