Skip to content

Commit

Permalink
Add note that make_kyword_only() must be the outer most decorator
Browse files Browse the repository at this point in the history
... to the error message, that gets thrown if it is not.
  • Loading branch information
timhoffm committed Apr 7, 2024
1 parent 146deee commit 163758a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/matplotlib/_api/deprecation.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,8 @@ def make_keyword_only(since, name, func=None):
assert (name in signature.parameters
and signature.parameters[name].kind == POK), (
f"Matplotlib internal error: {name!r} must be a positional-or-keyword "
f"parameter for {func.__name__}()")
f"parameter for {func.__name__}(). If this error happens on a function with a "
f"pyplot wrapper, make sure make_keyword_only() is the outermost decorator.")
names = [*signature.parameters]
name_idx = names.index(name)
kwonly = [name for name in names[name_idx:]
Expand Down

0 comments on commit 163758a

Please sign in to comment.