diff --git a/lib/matplotlib/figure.py b/lib/matplotlib/figure.py index 7034ea64c0d0..608ceaa99929 100644 --- a/lib/matplotlib/figure.py +++ b/lib/matplotlib/figure.py @@ -112,6 +112,8 @@ def add(self, key, a): """ Add Axes *a*, with key *key*, to the stack, and return the stack. + If *key* is unhashable, replace it by a unique, arbitrary object. + If *a* is already on the stack, don't add it again, but return *None*. """ @@ -122,8 +124,7 @@ def add(self, key, a): try: hash(key) except TypeError: - raise ValueError( - "first argument, {!r}, is not a valid key".format(key)) + key = object() a_existing = self.get(key) if a_existing is not None:
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: