Skip to content

Commit 71abe97

Browse files
authored
Merge pull request #21778 from meeseeksmachine/auto-backport-of-pr-21705-on-v3.5.x
Backport PR #21705 on branch v3.5.x (MNT: make print_figure kwarg wrapper support py311)
2 parents 826a96b + 1566a9b commit 71abe97

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/matplotlib/backend_bases.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1599,7 +1599,12 @@ def wrapper(*args, **kwargs):
15991599
r'^savefig|print_[A-Za-z0-9]+|_no_output_draw$'
16001600
)
16011601
seen_print_figure = False
1602-
for frame, line in traceback.walk_stack(None):
1602+
if sys.version_info < (3, 11):
1603+
current_frame = None
1604+
else:
1605+
import inspect
1606+
current_frame = inspect.currentframe()
1607+
for frame, line in traceback.walk_stack(current_frame):
16031608
if frame is None:
16041609
# when called in embedded context may hit frame is None.
16051610
break
@@ -1633,7 +1638,7 @@ def wrapper(*args, **kwargs):
16331638
if arg in accepted_kwargs:
16341639
continue
16351640
_api.warn_deprecated(
1636-
'3.3', name=name,
1641+
'3.3', name=name, removal='3.6',
16371642
message='%(name)s() got unexpected keyword argument "'
16381643
+ arg + '" which is no longer supported as of '
16391644
'%(since)s and will become an error '

0 commit comments

Comments
 (0)