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

Skip to content

Commit c3ee86a

Browse files
authored
Merge pull request #17815 from meeseeksmachine/auto-backport-of-pr-17814-on-v3.3.x
Backport PR #17814 on branch v3.3.x (Don't duplicate deprecated parameter addendum.)
2 parents fe238a5 + 4827c58 commit c3ee86a

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

lib/matplotlib/cbook/deprecation.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,8 @@ def func(used_arg, other_arg, unused, more_args): ...
379379
f"Matplotlib internal error: {name!r} must be a parameter for "
380380
f"{func.__name__}()")
381381

382+
addendum = kwargs.pop('addendum', None)
383+
382384
@functools.wraps(func)
383385
def wrapper(*inner_args, **inner_kwargs):
384386
arguments = signature.bind(*inner_args, **inner_kwargs).arguments
@@ -396,16 +398,15 @@ def wrapper(*inner_args, **inner_kwargs):
396398
# wrappers always pass all arguments explicitly.
397399
elif any(name in d and d[name] != _deprecated_parameter
398400
for d in [arguments, arguments.get(kwargs_name, {})]):
399-
addendum = (f"If any parameter follows {name!r}, they should be "
400-
f"passed as keyword, not positionally.")
401-
if kwargs.get("addendum"):
402-
kwargs["addendum"] += " " + addendum
403-
else:
404-
kwargs["addendum"] = addendum
401+
deprecation_addendum = (
402+
f"If any parameter follows {name!r}, they should be passed as "
403+
f"keyword, not positionally.")
405404
warn_deprecated(
406405
since,
407406
name=repr(name),
408407
obj_type=f"parameter of {func.__name__}()",
408+
addendum=(addendum + " " + deprecation_addendum) if addendum
409+
else deprecation_addendum,
409410
**kwargs)
410411
return func(*inner_args, **inner_kwargs)
411412

0 commit comments

Comments
 (0)