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

Skip to content

Commit a6bd231

Browse files
authored
Merge pull request #16613 from anntzer/ppd
Fix edge-case in preprocess_data, if label_namer is optional and unset.
2 parents a02edaa + daceb69 commit a6bd231

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

lib/matplotlib/__init__.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1382,9 +1382,6 @@ def inner(ax, *args, data=None, **kwargs):
13821382
return func(ax, *map(sanitize_sequence, args), **kwargs)
13831383

13841384
bound = new_sig.bind(ax, *args, **kwargs)
1385-
needs_label = (label_namer
1386-
and "label" not in bound.arguments
1387-
and "label" not in bound.kwargs)
13881385
auto_label = (bound.arguments.get(label_namer)
13891386
or bound.kwargs.get(label_namer))
13901387

@@ -1403,12 +1400,10 @@ def inner(ax, *args, data=None, **kwargs):
14031400
new_args = bound.args
14041401
new_kwargs = bound.kwargs
14051402

1406-
if needs_label:
1407-
all_kwargs = {**bound.arguments, **bound.kwargs}
1408-
# label_namer will be in all_kwargs as we asserted above that
1409-
# `label_namer is None or label_namer in arg_names`.
1403+
args_and_kwargs = {**bound.arguments, **bound.kwargs}
1404+
if label_namer and "label" not in args_and_kwargs:
14101405
new_kwargs["label"] = _label_from_arg(
1411-
all_kwargs[label_namer], auto_label)
1406+
args_and_kwargs.get(label_namer), auto_label)
14121407

14131408
return func(*new_args, **new_kwargs)
14141409

0 commit comments

Comments
 (0)