Skip to content

Commit 0334c94

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 0334c94

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

lib/matplotlib/backend_bases.py

+6
Original file line numberDiff line numberDiff line change
@@ -2105,6 +2105,12 @@ 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+
# When deprecation elapses, remove backend_ps._get_papertype & its callers.
2110+
_api.warn_deprecated(
2111+
"3.8", name="papertype='auto'", addendum="Pass an explicit paper type, "
2112+
"'figure', or omit the *papertype* argument entirely.")
2113+
21082114
# Remove the figure manager, if any, to avoid resizing the GUI widget.
21092115
with cbook._setattr_cm(self, manager=None), \
21102116
self._switch_canvas_and_return_print_method(format, backend) \

lib/matplotlib/backends/backend_ps.py

-6
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)