[Python-modules-team] Bug#917603: python3-yaml: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working

Niels Thykier niels at thykier.net
Sat Dec 29 04:40:43 GMT 2018


Package: python3-yaml
Version: 3.13-1
Severity: normal

Hi,

I spotted this in the CI job of britney2[1].

"""
tests/test_autopkgtest.py::T::test_alternative_gcc
  /usr/lib/python3/dist-packages/yaml/constructor.py:126: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
    if not isinstance(key, collections.Hashable):
"""

The code in question at the time of reporting (highlighed with "^"-marks):

"""
    def construct_mapping(self, node, deep=False):
        if not isinstance(node, MappingNode):
            raise ConstructorError(None, None,
                    "expected a mapping node, but found %s" % node.id,
                    node.start_mark)
        mapping = {}
        for key_node, value_node in node.value:
            key = self.construct_object(key_node, deep=deep)
            if not isinstance(key, collections.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)
            mapping[key] = value
        return mapping
"""

Presumably this is (or will be) fixed in a new upstream release but it
might make sense to cherry-pick that fix for buster to avoid breakage
in sid + buster at the moment.

Thanks,
~Niels

[1] https://salsa.debian.org/release-team/britney2/-/jobs/99062



More information about the Python-modules-team mailing list