8000 Suppress exception chaining in colormap lookup. · matplotlib/matplotlib@aa21ed8 · GitHub
[go: up one dir, main page]

Skip to content

Commit aa21ed8

Browse files
committed
Suppress exception chaining in colormap lookup.
Replace ``` Traceback (most recent call last): File "../matplotlib/cm.py", line 131, in __getitem__ return self._cmaps[item].copy() KeyError: 'foo' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "<string>", line 4, in <module> File ".../matplotlib/cm.py", line 133, in __getitem__ raise KeyError(f"{item!r} is not a known colormap name") KeyError: "'foo' is not a known colormap name" ``` by just the latter block.
1 parent d3cc9d7 commit aa21ed8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/matplotlib/cm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def __getitem__(self, item):
130130
try:
131131
return self._cmaps[item].copy()
132132
except KeyError:
133-
raise KeyError(f"{item!r} is not a known colormap name")
133+
raise KeyError(f"{item!r} is not a known colormap name") from None
134134

135135
def __iter__(self):
136136
return iter(self._cmaps)

0 commit comments

Comments
 (0)
0