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

Skip to content

MNT: make print_figure kwarg wrapper support py311 #21705

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 28, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions lib/matplotlib/backend_bases.py
Original file line number Diff line number Diff line change
Expand Up @@ -1601,7 +1601,12 @@ def wrapper(*args, **kwargs):
r'^savefig|print_[A-Za-z0-9]+|_no_output_draw$'
)
seen_print_figure = False
for frame, line in traceback.walk_stack(None):
if sys.version_info < (3, 11):
current_frame = None
else:
import inspect
current_frame = inspect.currentframe()
for frame, line in traceback.walk_stack(current_frame):
if frame is None:
# when called in embedded context may hit frame is None.
break
Expand Down Expand Up @@ -1635,7 +1640,7 @@ def wrapper(*args, **kwargs):
if arg in accepted_kwargs:
continue
_api.warn_deprecated(
'3.3', name=name,
'3.3', name=name, removal='3.6',
message='%(name)s() got unexpected keyword argument "'
+ arg + '" which is no longer supported as of '
'%(since)s and will become an error '
Expand Down