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

Skip to content

Commit 28a5f6d

Browse files
authored
Merge pull request #21705 from tacaswell/py311
MNT: make print_figure kwarg wrapper support py311
2 parents 171e74a + 74b45ff commit 28a5f6d

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
@@ -1601,7 +1601,12 @@ def wrapper(*args, **kwargs):
16011601
r'^savefig|print_[A-Za-z0-9]+|_no_output_draw$'
16021602
)
16031603
seen_print_figure = False
1604-
for frame, line in traceback.walk_stack(None):
1604+
if sys.version_info < (3, 11):
1605+
current_frame = None
1606+
else:
1607+
import inspect
1608+
current_frame = inspect.currentframe()
1609+
for frame, line in traceback.walk_stack(current_frame):
16051610
if frame is None:
16061611
# when called in embedded context may hit frame is None.
16071612
break
@@ -1635,7 +1640,7 @@ def wrapper(*args, **kwargs):
16351640
if arg in accepted_kwargs:
16361641
continue
16371642
_api.warn_deprecated(
1638-
'3.3', name=name,
1643+
'3.3', name=name, removal='3.6',
16391644
message='%(name)s() got unexpected keyword argument "'
16401645
+ arg + '" which is no longer supported as of '
16411646
'%(since)s and will become an error '

0 commit comments

Comments
 (0)