Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c9b3a73

Browse files
committed
Fix incorrect usage of nargs_error.
nargs_error simply returns the exception, the caller needs to throw it.
1 parent efd66d4 commit c9b3a73

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ def legend(self, *args, **kwargs):
321321
*args,
322322
**kwargs)
323323
if len(extra_args):
324-
_api.nargs_error('legend', '0-2', len(args))
324+
raise _api.nargs_error('legend', '0-2', len(args))
325325
self.legend_ = mlegend.Legend(self, handles, labels, **kwargs)
326326
self.legend_._remove_method = self._remove_legend
327327
return self.legend_
@@ -3005,7 +3005,7 @@ def stem(self, *args, linefmt=None, markerfmt=None, basefmt=None, bottom=0,
30053005
which inspired this method.
30063006
"""
30073007
if not 1 <= len(args) <= 3:
3008-
_api.nargs_error('stem', '1-3', len(args))
3008+
raise _api.nargs_error('stem', '1-3', len(args))
30093009
_api.check_in_list(['horizontal', 'vertical'], orientation=orientation)
30103010

30113011
if len(args) == 1:
@@ -6422,7 +6422,7 @@ def pcolorfast(self, *args, alpha=None, norm=None, cmap=None, vmin=None,
64226422
else:
64236423
raise TypeError("arguments do not match valid signatures")
64246424
else:
6425-
_api.nargs_error('pcolorfast', '1 or 3', len(args))
6425+
raise _api.nargs_error('pcolorfast', '1 or 3', len(args))
64266426

64276427
if style == "quadmesh":
64286428
# data point in each cell is value at lower left corner

lib/matplotlib/rcsetup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,7 @@ def cycler(*args, **kwargs):
693693
elif len(args) == 2:
694694
pairs = [(args[0], args[1])]
695695
elif len(args) > 2:
696-
_api.nargs_error('cycler', '0-2', len(args))
696+
raise _api.nargs_error('cycler', '0-2', len(args))
697697
else:
698698
pairs = kwargs.items()
699699

0 commit comments

Comments
 (0)