10000 DOC: add note about why we do extra work in this internal function · matplotlib/matplotlib@1f7e0ef · GitHub
[go: up one dir, main page]

Skip to content

Commit 1f7e0ef

Browse files
committed
DOC: add note about why we do extra work in this internal function
1 parent 0b6b385 commit 1f7e0ef

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/matplotlib/cm.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -702,5 +702,7 @@ def _ensure_cmap(cmap):
702702
if isinstance(cmap, colors.Colormap):
703703
return cmap
704704
cmap_name = cmap if cmap is not None else mpl.rcParams["image.cmap"]
705+
# use check_in_list to ensure type stability of the exception raised by
706+
# the internal usage of this (ValueError vs KeyError)
705707
_api.check_in_list(sorted(_colormaps), cmap=cmap_name)
706708
return mpl.colormaps[cmap_name]

0 commit comments

Comments
 (0)
0