mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-08-08 14:24:46 +03:00
Merge branch 'main' into setuptools_scm
This commit is contained in:
commit
1d134dd283
6
.github/workflows/lint.yml
vendored
6
.github/workflows/lint.yml
vendored
|
@ -2,6 +2,9 @@ name: Lint
|
|||
|
||||
on: [push, pull_request, workflow_dispatch]
|
||||
|
||||
env:
|
||||
FORCE_COLOR: 1
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
|
@ -46,3 +49,6 @@ jobs:
|
|||
run: tox -e lint
|
||||
env:
|
||||
PRE_COMMIT_COLOR: always
|
||||
|
||||
- name: Mypy
|
||||
run: tox -e mypy
|
||||
|
|
2
.github/workflows/system-info.py
vendored
2
.github/workflows/system-info.py
vendored
|
@ -6,6 +6,8 @@ This sort of info is missing from GitHub Actions.
|
|||
Requested here:
|
||||
https://github.com/actions/virtual-environments/issues/79
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import platform
|
||||
import sys
|
||||
|
|
15
CHANGES.rst
15
CHANGES.rst
|
@ -5,6 +5,21 @@ Changelog (Pillow)
|
|||
10.2.0 (unreleased)
|
||||
-------------------
|
||||
|
||||
- Attempt memory mapping when tile args is a string #7565
|
||||
[radarhere]
|
||||
|
||||
- Fill identical pixels with transparency in subsequent frames when saving GIF #7568
|
||||
[radarhere]
|
||||
|
||||
- Corrected duration when combining multiple GIF frames into single frame #7521
|
||||
[radarhere]
|
||||
|
||||
- Handle disposing GIF background from outside palette #7515
|
||||
[radarhere]
|
||||
|
||||
- Seek past the data when skipping a PSD layer #7483
|
||||
[radarhere]
|
||||
|
||||
- Import plugins relative to the module #7576
|
||||
[deliangyang, jaxx0n]
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#!/usr/bin/env python3
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import time
|
||||
|
||||
from PIL import PyAccess
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#!/usr/bin/env python3
|
||||
from __future__ import annotations
|
||||
|
||||
from PIL import Image
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
from PIL import Image
|
||||
|
||||
TEST_FILE = "Tests/images/fli_overflow.fli"
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
# Tests potential DOS of IcnsImagePlugin with 0 length block.
|
||||
# Run from anywhere that PIL is importable.
|
||||
from __future__ import annotations
|
||||
|
||||
from io import BytesIO
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#!/usr/bin/env python3
|
||||
from __future__ import annotations
|
||||
import pytest
|
||||
|
||||
from PIL import Image
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
# Tests potential DOS of Jpeg2kImagePlugin with 0 length block.
|
||||
# Run from anywhere that PIL is importable.
|
||||
from __future__ import annotations
|
||||
|
||||
from io import BytesIO
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
from io import BytesIO
|
||||
|
||||
import pytest
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import pytest
|
||||
|
||||
from PIL import Image
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
# the output should be empty. There may be python issues
|
||||
# in the valgrind especially if run in a debug python
|
||||
# version.
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
from PIL import Image
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
from io import BytesIO
|
||||
|
||||
import pytest
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import sys
|
||||
|
||||
import pytest
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import sys
|
||||
|
||||
import pytest
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import pytest
|
||||
|
||||
from PIL import Image
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import zlib
|
||||
from io import BytesIO
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import sys
|
||||
|
||||
from PIL import features
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import io
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#!/usr/bin/env python3
|
||||
from __future__ import annotations
|
||||
import base64
|
||||
import os
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
"""
|
||||
Helper functions.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
import os
|
||||
|
|
BIN
Tests/images/background_outside_palette.gif
Normal file
BIN
Tests/images/background_outside_palette.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 82 B |
BIN
Tests/images/five_channels.psd
Normal file
BIN
Tests/images/five_channels.psd
Normal file
Binary file not shown.
|
@ -13,6 +13,7 @@
|
|||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
import atheris
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
import atheris
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import io
|
||||
import warnings
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
from PIL import Image
|
||||
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
from PIL import _binary
|
||||
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import os
|
||||
import warnings
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import pytest
|
||||
|
||||
from PIL import Image, ImageFilter
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
from array import array
|
||||
|
||||
import pytest
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import sys
|
||||
|
||||
import pytest
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import pytest
|
||||
|
||||
from PIL import Image
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import pytest
|
||||
|
||||
from PIL import _deprecate
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import io
|
||||
import re
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import pytest
|
||||
|
||||
from PIL import Image, ImageSequence, PngImagePlugin
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import pytest
|
||||
|
||||
from PIL import Image
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import io
|
||||
|
||||
import pytest
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import pytest
|
||||
|
||||
from PIL import BufrStubImagePlugin, Image
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import pytest
|
||||
|
||||
from PIL import ContainerIO, Image
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import pytest
|
||||
|
||||
from PIL import CurImagePlugin, Image
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import warnings
|
||||
|
||||
import pytest
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Test DdsImagePlugin"""
|
||||
from __future__ import annotations
|
||||
from io import BytesIO
|
||||
|
||||
import pytest
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import io
|
||||
|
||||
import pytest
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
from io import BytesIO
|
||||
|
||||
import pytest
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import warnings
|
||||
|
||||
import pytest
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import pytest
|
||||
|
||||
from PIL import Image
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import pytest
|
||||
|
||||
from PIL import FtexImagePlugin, Image
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import pytest
|
||||
|
||||
from PIL import GbrImagePlugin, Image
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import pytest
|
||||
|
||||
from PIL import GdImageFile, UnidentifiedImageError
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import warnings
|
||||
from io import BytesIO
|
||||
|
||||
|
@ -217,6 +218,27 @@ def test_optimize_if_palette_can_be_reduced_by_half():
|
|||
assert len(reloaded.palette.palette) // 3 == colors
|
||||
|
||||
|
||||
def test_full_palette_second_frame(tmp_path):
|
||||
out = str(tmp_path / "temp.gif")
|
||||
im = Image.new("P", (1, 256))
|
||||
|
||||
full_palette_im = Image.new("P", (1, 256))
|
||||
for i in range(256):
|
||||
full_palette_im.putpixel((0, i), i)
|
||||
full_palette_im.palette = ImagePalette.ImagePalette(
|
||||
"RGB", bytearray(i // 3 for i in range(768))
|
||||
)
|
||||
full_palette_im.palette.dirty = 1
|
||||
|
||||
im.save(out, save_all=True, append_images=[full_palette_im])
|
||||
|
||||
with Image.open(out) as reloaded:
|
||||
reloaded.seek(1)
|
||||
|
||||
for i in range(256):
|
||||
reloaded.getpixel((0, i)) == i
|
||||
|
||||
|
||||
def test_roundtrip(tmp_path):
|
||||
out = str(tmp_path / "temp.gif")
|
||||
im = hopper()
|
||||
|
@ -856,7 +878,14 @@ def test_identical_frames(tmp_path):
|
|||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"duration", ([1000, 1500, 2000, 4000], (1000, 1500, 2000, 4000), 8500)
|
||||
"duration",
|
||||
(
|
||||
[1000, 1500, 2000],
|
||||
(1000, 1500, 2000),
|
||||
# One more duration than the number of frames
|
||||
[1000, 1500, 2000, 4000],
|
||||
1500,
|
||||
),
|
||||
)
|
||||
def test_identical_frames_to_single_frame(duration, tmp_path):
|
||||
out = str(tmp_path / "temp.gif")
|
||||
|
@ -872,7 +901,7 @@ def test_identical_frames_to_single_frame(duration, tmp_path):
|
|||
assert reread.n_frames == 1
|
||||
|
||||
# Assert that the new duration is the total of the identical frames
|
||||
assert reread.info["duration"] == 8500
|
||||
assert reread.info["duration"] == 4500
|
||||
|
||||
|
||||
def test_loop_none(tmp_path):
|
||||
|
@ -1142,6 +1171,12 @@ def test_rgba_transparency(tmp_path):
|
|||
assert_image_equal(hopper("P").convert("RGB"), reloaded)
|
||||
|
||||
|
||||
def test_background_outside_palettte(tmp_path):
|
||||
with Image.open("Tests/images/background_outside_palette.gif") as im:
|
||||
im.seek(1)
|
||||
assert im.info["background"] == 255
|
||||
|
||||
|
||||
def test_bbox(tmp_path):
|
||||
out = str(tmp_path / "temp.gif")
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
from PIL import GimpGradientFile, ImagePalette
|
||||
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import pytest
|
||||
|
||||
from PIL.GimpPaletteFile import GimpPaletteFile
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import pytest
|
||||
|
||||
from PIL import GribStubImagePlugin, Image
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import pytest
|
||||
|
||||
from PIL import Hdf5StubImagePlugin, Image
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import io
|
||||
import os
|
||||
import warnings
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import io
|
||||
import os
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import filecmp
|
||||
import warnings
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import io
|
||||
|
||||
import pytest
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import sys
|
||||
from io import BytesIO, StringIO
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import os
|
||||
import re
|
||||
import warnings
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import os
|
||||
import re
|
||||
from io import BytesIO
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import base64
|
||||
import io
|
||||
import itertools
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
from io import BytesIO
|
||||
|
||||
from PIL import Image
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import pytest
|
||||
|
||||
from PIL import Image, McIdasImagePlugin
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import pytest
|
||||
|
||||
from PIL import Image, ImagePalette
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import warnings
|
||||
from io import BytesIO
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import os
|
||||
|
||||
import pytest
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import os.path
|
||||
import subprocess
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
from PIL import Image
|
||||
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import pytest
|
||||
|
||||
from PIL import Image, ImageFile, PcxImagePlugin
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import io
|
||||
import os
|
||||
import os.path
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import pytest
|
||||
|
||||
from PIL import Image, PixarImagePlugin
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import re
|
||||
import sys
|
||||
import warnings
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import sys
|
||||
from io import BytesIO
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import warnings
|
||||
|
||||
import pytest
|
||||
|
@ -111,6 +112,11 @@ def test_rgba():
|
|||
assert_image_equal_tofile(im, "Tests/images/imagedraw_square.png")
|
||||
|
||||
|
||||
def test_layer_skip():
|
||||
with Image.open("Tests/images/five_channels.psd") as im:
|
||||
assert im.n_frames == 1
|
||||
|
||||
|
||||
def test_icc_profile():
|
||||
with Image.open(test_file) as im:
|
||||
assert "icc_profile" in im.info
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import pytest
|
||||
|
||||
from PIL import Image, QoiImagePlugin
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import pytest
|
||||
|
||||
from PIL import Image, SgiImagePlugin
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import tempfile
|
||||
import warnings
|
||||
from io import BytesIO
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import os
|
||||
|
||||
import pytest
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import warnings
|
||||
|
||||
import pytest
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import os
|
||||
from glob import glob
|
||||
from itertools import product
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import os
|
||||
import warnings
|
||||
from io import BytesIO
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import io
|
||||
import struct
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
from PIL import WalImageFile
|
||||
|
||||
from .helper import assert_image_equal_tofile
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import io
|
||||
import re
|
||||
import sys
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import pytest
|
||||
|
||||
from PIL import Image
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import pytest
|
||||
from packaging.version import parse as parse_version
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import pytest
|
||||
|
||||
from PIL import Image
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
from io import BytesIO
|
||||
|
||||
import pytest
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import pytest
|
||||
|
||||
from PIL import Image, WmfImagePlugin
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
from io import BytesIO
|
||||
|
||||
import pytest
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import pytest
|
||||
|
||||
from PIL import Image, XpmImagePlugin
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import pytest
|
||||
|
||||
from PIL import Image, XVThumbImagePlugin
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import pytest
|
||||
|
||||
from PIL import BdfFontFile, FontFile
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
import pytest
|
||||
|
||||
from PIL import Image, ImageDraw, ImageFont
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import annotations
|
||||
from PIL import Image, ImageDraw, ImageFont
|
||||
|
||||
from .helper import PillowLeakTestCase, skip_unless_feature
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user