Merge branch 'main' into mode_enums

This commit is contained in:
Andrew Murray 2025-03-17 13:30:23 +11:00 committed by GitHub
commit 8dca9c76cc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
14 changed files with 45 additions and 24 deletions

View File

@ -20,7 +20,7 @@ fi
set -e
if [[ $(uname) != CYGWIN* ]]; then
sudo apt-get -qq install libfreetype6-dev liblcms2-dev python3-tk\
sudo apt-get -qq install libfreetype6-dev liblcms2-dev libtiff-dev python3-tk\
ghostscript libjpeg-turbo8-dev libopenjp2-7-dev\
cmake meson imagemagick libharfbuzz-dev libfribidi-dev\
sway wl-clipboard libopenblas-dev

View File

@ -1 +1 @@
cibuildwheel==2.23.0
cibuildwheel==2.23.1

View File

@ -16,6 +16,6 @@
}
],
"schedule": [
"on the 3rd day of the month"
"* * 3 * *"
]
}

View File

@ -35,6 +35,10 @@ jobs:
matrix:
os: ["ubuntu-latest"]
docker: [
# Run slower jobs first to give them a headstart and reduce waiting time
ubuntu-24.04-noble-ppc64le,
ubuntu-24.04-noble-s390x,
# Then run the remainder
alpine,
amazon-2-amd64,
amazon-2023-amd64,
@ -52,13 +56,9 @@ jobs:
dockerTag: [main]
include:
- docker: "ubuntu-24.04-noble-ppc64le"
os: "ubuntu-22.04"
qemu-arch: "ppc64le"
dockerTag: main
- docker: "ubuntu-24.04-noble-s390x"
os: "ubuntu-22.04"
qemu-arch: "s390x"
dockerTag: main
- docker: "ubuntu-24.04-noble-arm64v8"
os: "ubuntu-24.04-arm"
dockerTag: main
@ -75,8 +75,9 @@ jobs:
- name: Set up QEMU
if: "matrix.qemu-arch"
run: |
docker run --rm --privileged aptman/qus -s -- -p ${{ matrix.qemu-arch }}
uses: docker/setup-qemu-action@v3
with:
platforms: ${{ matrix.qemu-arch }}
- name: Docker pull
run: |

View File

@ -94,8 +94,8 @@ jobs:
choco install nasm --no-progress
echo "C:\Program Files\NASM" >> $env:GITHUB_PATH
choco install ghostscript --version=10.4.0 --no-progress
echo "C:\Program Files\gs\gs10.04.0\bin" >> $env:GITHUB_PATH
choco install ghostscript --version=10.5.0 --no-progress
echo "C:\Program Files\gs\gs10.05.0\bin" >> $env:GITHUB_PATH
# Install extra test images
xcopy /S /Y Tests\test-images\* Tests\images

View File

@ -43,7 +43,7 @@ LIBPNG_VERSION=1.6.47
JPEGTURBO_VERSION=3.1.0
OPENJPEG_VERSION=2.5.3
XZ_VERSION=5.6.4
TIFF_VERSION=4.6.0
TIFF_VERSION=4.7.0
LCMS2_VERSION=2.17
ZLIB_NG_VERSION=2.2.4
LIBWEBP_VERSION=1.5.0

View File

@ -34,8 +34,11 @@ def test_apng_basic() -> None:
with pytest.raises(EOFError):
im.seek(2)
# test rewind support
im.seek(0)
with pytest.raises(ValueError, match="cannot seek to frame 2"):
im._seek(2)
# test rewind support
assert im.getpixel((0, 0)) == (255, 0, 0, 255)
assert im.getpixel((64, 32)) == (255, 0, 0, 255)
im.seek(1)

View File

@ -1,5 +1,6 @@
from __future__ import annotations
import io
import warnings
import pytest
@ -132,6 +133,15 @@ def test_eoferror() -> None:
im.seek(n_frames - 1)
def test_missing_frame_size() -> None:
with open(animated_test_file, "rb") as fp:
data = fp.read()
data = data[:6188]
with Image.open(io.BytesIO(data)) as im:
with pytest.raises(EOFError, match="missing frame size"):
im.seek(1)
def test_seek_tell() -> None:
with Image.open(animated_test_file) as im:
layer_number = im.tell()
@ -160,6 +170,9 @@ def test_seek() -> None:
assert_image_equal_tofile(im, "Tests/images/a_fli.png")
with pytest.raises(ValueError, match="cannot seek to frame 52"):
im._seek(52)
@pytest.mark.parametrize(
"test_file",

View File

@ -410,6 +410,10 @@ def test_seek() -> None:
except EOFError:
assert frame_count == 5
img.seek(0)
with pytest.raises(ValueError, match="cannot seek to frame 2"):
img._seek(2)
def test_seek_info() -> None:
with Image.open("Tests/images/iss634.gif") as im:

View File

@ -317,12 +317,12 @@ def test_grayscale_four_channels() -> None:
with open("Tests/images/rgb_trns_ycbc.jp2", "rb") as fp:
data = fp.read()
# Change color space to OPJ_CLRSPC_GRAY
data = data[:76] + b"\x11" + data[77:]
# Change color space to OPJ_CLRSPC_GRAY
data = data[:76] + b"\x11" + data[77:]
with Image.open(BytesIO(data)) as im:
im.load()
assert im.mode == "RGBA"
with Image.open(BytesIO(data)) as im:
im.load()
assert im.mode == "RGBA"
@pytest.mark.skipif(

View File

@ -40,7 +40,7 @@ def test_sanity(tmp_path: Path) -> None:
def test_bad_image_size() -> None:
with open("Tests/images/pil184.pcx", "rb") as fp:
data = fp.read()
data = data[:4] + b"\xff\xff" + data[6:]
data = data[:4] + b"\xff\xff" + data[6:]
b = io.BytesIO(data)
with pytest.raises(SyntaxError, match="bad PCX image size"):
@ -51,7 +51,7 @@ def test_bad_image_size() -> None:
def test_unknown_mode() -> None:
with open("Tests/images/pil184.pcx", "rb") as fp:
data = fp.read()
data = data[:3] + b"\xff" + data[4:]
data = data[:3] + b"\xff" + data[4:]
b = io.BytesIO(data)
with pytest.raises(OSError, match="unknown PCX mode"):

View File

@ -20,8 +20,8 @@ def test_sanity() -> None:
def test_zero_width_chars() -> None:
with open(filename, "rb") as fp:
data = fp.read()
data = data[:2650] + b"\x00\x00" + data[2652:]
BdfFontFile.BdfFontFile(io.BytesIO(data))
data = data[:2650] + b"\x00\x00" + data[2652:]
BdfFontFile.BdfFontFile(io.BytesIO(data))
def test_invalid_file() -> None:

View File

@ -44,7 +44,7 @@ Many of Pillow's features require external libraries:
* **libtiff** provides compressed TIFF functionality
* Pillow has been tested with libtiff versions **3.x** and **4.0-4.6.0**
* Pillow has been tested with libtiff versions **3.x** and **4.0-4.7.0**
* **libfreetype** provides type related services

View File

@ -120,7 +120,7 @@ V = {
"LIBPNG": "1.6.47",
"LIBWEBP": "1.5.0",
"OPENJPEG": "2.5.3",
"TIFF": "4.6.0",
"TIFF": "4.7.0",
"XZ": "5.6.4",
"ZLIBNG": "2.2.4",
}