diff --git a/lib/matplotlib/__init__.py b/lib/matplotlib/__init__.py index 0b1b0e57dc6d..ca7ee60b9c2f 100644 --- a/lib/matplotlib/__init__.py +++ b/lib/matplotlib/__init__.py @@ -1502,6 +1502,8 @@ def func(foo, label=None): ... @functools.wraps(func) def inner(ax, *args, data=None, **kwargs): + __tracebackhide__ = True + if data is None: return func( ax, diff --git a/lib/matplotlib/_api/deprecation.py b/lib/matplotlib/_api/deprecation.py index 65a754bbb43d..04d13e80bdea 100644 --- a/lib/matplotlib/_api/deprecation.py +++ b/lib/matplotlib/_api/deprecation.py @@ -194,6 +194,7 @@ def emit_warning(): removal=removal) def wrapper(*args, **kwargs): + __tracebackhide__ = True emit_warning() return func(*args, **kwargs) @@ -286,6 +287,8 @@ def func(good_name): ... @functools.wraps(func) def wrapper(*args, **kwargs): + __tracebackhide__ = True + if old in kwargs: warn_deprecated( since, message=f"The {old!r} parameter of {func.__name__}() " @@ -376,6 +379,8 @@ def func(used_arg, other_arg, unused, more_args): ... @functools.wraps(func) def wrapper(*inner_args, **inner_kwargs): + __tracebackhide__ = True + if len(inner_args) <= name_idx and name not in inner_kwargs: # Early return in the simple, non-deprecated case (much faster than # calling bind()). @@ -441,6 +446,8 @@ def make_keyword_only(since, name, func=None): @functools.wraps(func) def wrapper(*args, **kwargs): + __tracebackhide__ = True + # Don't use signature.bind here, as it would fail when stacked with # rename_parameter and an "old" argument name is passed in # (signature.bind would fail, but the actual call would succeed).