There was an error while loading. Please reload this page.
2 parents ad318d9 + 520120b commit b042615Copy full SHA for b042615
2 files changed
azure-pipelines.yml
@@ -134,6 +134,9 @@ stages:
134
- script: env
135
displayName: 'print env'
136
137
+ - script: pip list
138
+ displayName: 'print pip'
139
+
140
- bash: |
141
PYTHONFAULTHANDLER=1 python -m pytest --junitxml=junit/test-results.xml -raR --maxfail=50 --timeout=300 --durations=25 --cov-report= --cov=lib -n 2 ||
142
[[ "$PYTHON_VERSION" = 'Pre' ]]
lib/matplotlib/backends/backend_pdf.py
@@ -1718,8 +1718,13 @@ def _writeImg(self, data, id, smask=None):
1718
# Convert to indexed color if there are 256 colors or fewer
1719
# This can significantly reduce the file size
1720
num_colors = len(img_colors)
1721
- img = img.convert(mode='P', dither=Image.NONE,
1722
- palette=Image.ADAPTIVE, colors=num_colors)
+ # These constants were converted to IntEnums and deprecated in
+ # Pillow 9.2
1723
+ dither = getattr(Image, 'Dither', Image).NONE
1724
+ pmode = getattr(Image, 'Palette', Image).ADAPTIVE
1725
+ img = img.convert(
1726
+ mode='P', dither=dither, palette=pmode, colors=num_colors
1727
+ )
1728
png_data, bit_depth, palette = self._writePng(img)
1729
if bit_depth is None or palette is None:
1730
raise RuntimeError("invalid PNG header")
0 commit comments