Skip to content

Commit ffb8969

Browse files
committed
ensure error reporting is sorted
1 parent 3991dc6 commit ffb8969

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/matplotlib/cm.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -735,5 +735,6 @@ def _ensure_cmap(cmap):
735735
cmap_name = cmap if cmap is not None else mpl.rcParams["image.cmap"]
736736
# use check_in_list to ensure type stability of the exception raised by
737737
# the internal usage of this (ValueError vs KeyError)
738-
_api.check_in_list(list(_colormaps), cmap=cmap_name)
738+
if cmap_name not in _colormaps:
739+
_api.check_in_list(sorted(_colormaps), cmap=cmap_name)
739740
return mpl.colormaps[cmap_name]

0 commit comments

Comments
 (0)