From f7590a2e480a5613546bef42f0f044e279c32cf6 Mon Sep 17 00:00:00 2001 From: Manuel Goacolou Date: Thu, 20 Jun 2019 10:25:49 +0200 Subject: [PATCH] use only hashable objects --- lib/matplotlib/figure.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/matplotlib/figure.py b/lib/matplotlib/figure.py index 2896a2477ddd..43db5c68e371 100644 --- a/lib/matplotlib/figure.py +++ b/lib/matplotlib/figure.py @@ -1072,6 +1072,11 @@ def fixitems(items): # to tuples for the key ret = [] for k, v in items: + # some objects are not hashable: skip them + try: + hash(v) + except Exception: + continue # some objects can define __getitem__ without being # iterable and in those cases the conversion to tuples # will fail. So instead of using the np.iterable(v) function