Skip to content

Commit dfce0b2

Browse files
committed
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.
1 parent 1182770 commit dfce0b2

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

lib/matplotlib/cbook/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2281,9 +2281,7 @@ def safe_first_element(obj):
22812281

22822282
def sanitize_sequence(data):
22832283
"""Converts dictview object to list"""
2284-
if six.PY3 and isinstance(data, collections.abc.MappingView):
2285-
return list(data)
2286-
return data
2284+
return list(data) if isinstance(data, collections.MappingView) else data
22872285

22882286

22892287
def normalize_kwargs(kw, alias_mapping=None, required=(), forbidden=(),

0 commit comments

Comments
 (0)