Package: python-fysom Version: 2.1.5-3 Severity: normal Dear Maintainer,
in python 3.10, "from collections import Mapping" doesn't work anymore and should be imported from collections.abc $ python3 debian/tests/import3 Traceback (most recent call last): File "/home/ubuntu/deb/python-fysom/python-fysom/debian/tests/import3", line 4, in <module> fsm = Fysom({'initial': 'green', File "/usr/lib/python3/dist-packages/fysom/__init__.py", line 162, in __init__ if isinstance(e, collections.Mapping): AttributeError: module 'collections' has no attribute 'Mapping' Upstream fixed this in 2.1.6, and this is the patch: https://github.com/mriehl/fysom/commit/1ed6950d2b683a9a2a2ab35dfd0ea79dc2963dc3 >From 1ed6950d2b683a9a2a2ab35dfd0ea79dc2963dc3 Mon Sep 17 00:00:00 2001 From: Karthikeyan Singaravelan <tir.kar...@gmail.com> Date: Thu, 9 Apr 2020 14:32:14 +0000 Subject: [PATCH] Import ABC from collections.abc instead of collections for Python 3 compatibility. --- src/main/python/fysom/__init__.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/python/fysom/__init__.py b/src/main/python/fysom/__init__.py index 6458bbb..179512f 100644 --- a/src/main/python/fysom/__init__.py +++ b/src/main/python/fysom/__init__.py @@ -27,12 +27,16 @@ # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -import collections import functools import weakref import types import sys +try: + from collections.abc import Mapping +except ImportError: + from collections import Mapping + __author__ = 'Mansour Behabadi' __copyright__ = 'Copyright 2011, Mansour Behabadi and Jake Gordon' __credits__ = ['Mansour Behabadi', 'Jake Gordon'] @@ -159,7 +163,7 @@ def __init__(self, cfg={}, initial=None, events=None, callbacks=None, # convert 3-tuples in the event specification to dicts events_dicts = [] for e in cfg["events"]: - if isinstance(e, collections.Mapping): + if isinstance(e, Mapping): events_dicts.append(e) elif hasattr(e, "__iter__"): name, src, dst = list(e)[:3] @@ -520,7 +524,7 @@ def is_very_angry(self, event): # convert 3-tuples in the event specification to dicts events_dicts = [] for e in cfg["events"]: - if isinstance(e, collections.Mapping): + if isinstance(e, Mapping): events_dicts.append(e) elif hasattr(e, "__iter__"): name, src, dst = list(e)[:3]