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

Skip to content

Commit 223e85a

Browse files
committed
Move papersize="auto" deprecation to backend_bases.
This makes it easier for mplcairo (which also outputs PostScript natively) to inherit the deprecation and be able to run the matplotlib test suite both with matplotlib 3.7 (where there should be no warning) and with matplotlib 3.8 (where there should be a warning).
1 parent e237bbd commit 223e85a

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

lib/matplotlib/backend_bases.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2105,6 +2105,11 @@ def print_figure(
21052105
if dpi == 'figure':
21062106
dpi = getattr(self.figure, '_original_dpi', self.figure.dpi)
21072107

2108+
if kwargs.get("papertype") == 'auto':
2109+
_api.warn_deprecated(
2110+
"3.8", name="papertype='auto'", addendum="Pass an explicit paper type, "
2111+
"'figure', or omit the *papertype* argument entirely.")
2112+
21082113
# Remove the figure manager, if any, to avoid resizing the GUI widget.
21092114
with cbook._setattr_cm(self, manager=None), \
21102115
self._switch_canvas_and_return_print_method(format, backend) \

lib/matplotlib/backends/backend_ps.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -867,9 +867,6 @@ def _print_figure(
867867
# find the appropriate papertype
868868
width, height = self.figure.get_size_inches()
869869
if papertype == 'auto':
870-
_api.warn_deprecated("3.8", name="papertype='auto'",
871-
addendum="Pass an explicit paper type, 'figure', or "
872-
"omit the *papertype* argument entirely.")
873870
papertype = _get_papertype(*orientation.swap_if_landscape((width, height)))
874871

875872
if is_eps or papertype == 'figure':
@@ -1053,9 +1050,6 @@ def _print_figure_tex(
10531050
self.figure.get_size_inches())
10541051
else:
10551052
if papertype == 'auto':
1056-
_api.warn_deprecated("3.8", name="papertype='auto'",
1057-
addendum="Pass an explicit paper type, or "
1058-
"omit the *papertype* argument entirely.")
10591053
papertype = _get_papertype(width, height)
10601054
paper_width, paper_height = papersize[papertype]
10611055

0 commit comments

Comments
 (0)