From dfce0b23e7a403a8ea6679b745476f29766b3fa6 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Mon, 27 Feb 2017 09:57:47 -0800 Subject: [PATCH] MAINT: mappingview check for Python 3.4 Python 3.4 does not automatically import module `abc` into `collections`, causing an error when checking for `collections.abc.MappingView`. Use `collections.MappingView` to work round this difference. At some point Python may deprecate `collections.MappingView` in favor of `collections.abc.MappingView` but we can fix that when it arises. --- lib/matplotlib/cbook/__init__.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/matplotlib/cbook/__init__.py b/lib/matplotlib/cbook/__init__.py index 5016ef429607..622464ccbc7b 100644 --- a/lib/matplotlib/cbook/__init__.py +++ b/lib/matplotlib/cbook/__init__.py @@ -2281,9 +2281,7 @@ def safe_first_element(obj): def sanitize_sequence(data): """Converts dictview object to list""" - if six.PY3 and isinstance(data, collections.abc.MappingView): - return list(data) - return data + return list(data) if isinstance(data, collections.MappingView) else data def normalize_kwargs(kw, alias_mapping=None, required=(), forbidden=(),