From 163758a22bcdfb48223cb19bf4a8da67fb3da0ca Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Tue, 13 Feb 2024 23:28:59 +0100 Subject: [PATCH] Add note that make_kyword_only() must be the outer most decorator ... to the error message, that gets thrown if it is not. --- lib/matplotlib/_api/deprecation.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/_api/deprecation.py b/lib/matplotlib/_api/deprecation.py index 283a55f1beb0..e9722f5d26c4 100644 --- a/lib/matplotlib/_api/deprecation.py +++ b/lib/matplotlib/_api/deprecation.py @@ -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:]