Skip to content

Commit 71df356

Browse files
committed
Merge branch 'master' into msys
2 parents 041268a + d48dca3 commit 71df356

18 files changed

+99
-97
lines changed

.ci/install.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ python3 -m pip install -U pytest-timeout
3737
python3 -m pip install pyroma
3838

3939
if [[ $(uname) != CYGWIN* ]]; then
40-
python3 -m pip install numpy
40+
# TODO Remove condition when NumPy supports 3.12
41+
if ! [ "$GHA_PYTHON_VERSION" == "3.12-dev" ]; then python3 -m pip install numpy ; fi
4142

4243
# PyQt6 doesn't support PyPy3
4344
if [[ $GHA_PYTHON_VERSION == 3.* ]]; then

.github/workflows/macos-install.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ python3 -m pip install -U pytest-cov
1313
python3 -m pip install -U pytest-timeout
1414
python3 -m pip install pyroma
1515

16-
python3 -m pip install numpy
16+
# TODO Remove condition when NumPy supports 3.12
17+
if ! [ "$GHA_PYTHON_VERSION" == "3.12-dev" ]; then python3 -m pip install numpy ; fi
1718

1819
# extra test images
1920
pushd depends && ./install_extra_test_images.sh && popd

.github/workflows/test-docker.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ jobs:
8787
with:
8888
flags: GHA_Docker
8989
name: ${{ matrix.docker }}
90+
gcov: true
9091

9192
success:
9293
permissions:

.github/workflows/test-windows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
strategy:
1616
fail-fast: false
1717
matrix:
18-
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
18+
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12-dev"]
1919
architecture: ["x86", "x64"]
2020
include:
2121
# PyPy 7.3.4+ only ships 64-bit binaries for Windows

.github/workflows/test.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ jobs:
2222
python-version: [
2323
"pypy3.9",
2424
"pypy3.8",
25+
"3.12-dev",
2526
"3.11",
2627
"3.10",
2728
"3.9",
@@ -107,9 +108,9 @@ jobs:
107108
- name: Upload coverage
108109
uses: codecov/codecov-action@v3
109110
with:
110-
file: ./coverage.xml
111111
flags: ${{ matrix.os == 'macos-latest' && 'GHA_macOS' || 'GHA_Ubuntu' }}
112112
name: ${{ matrix.os }} Python ${{ matrix.python-version }}
113+
gcov: true
113114

114115
success:
115116
permissions:

CHANGES.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ Changelog (Pillow)
55
9.5.0 (unreleased)
66
------------------
77

8+
- Fixed writing int as UNDEFINED tag #6950
9+
[radarhere]
10+
11+
- Raise an error if EXIF data is too long when saving JPEG #6939
12+
[radarhere]
13+
814
- Handle more than one directory returned by pkg-config #6896
915
[sebastic, radarhere]
1016

LICENSE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ By obtaining, using, and/or copying this software and/or its associated
1313
documentation, you agree that you have read, understood, and will comply
1414
with the following terms and conditions:
1515

16-
Permission to use, copy, modify, and distribute this software and its
17-
associated documentation for any purpose and without fee is hereby granted,
16+
Permission to use, copy, modify and distribute this software and its
17+
documentation for any purpose and without fee is hereby granted,
1818
provided that the above copyright notice appears in all copies, and that
1919
both that copyright notice and this permission notice appear in supporting
2020
documentation, and that the name of Secret Labs AB or the author not be

Tests/test_file_jpeg.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,10 @@ def test_large_exif(self, tmp_path):
270270
# https://github.com/python-pillow/Pillow/issues/148
271271
f = str(tmp_path / "temp.jpg")
272272
im = hopper()
273-
im.save(f, "JPEG", quality=90, exif=b"1" * 65532)
273+
im.save(f, "JPEG", quality=90, exif=b"1" * 65533)
274+
275+
with pytest.raises(ValueError):
276+
im.save(f, "JPEG", quality=90, exif=b"1" * 65534)
274277

275278
def test_exif_typeerror(self):
276279
with Image.open("Tests/images/exif_typeerror.jpg") as im:
@@ -445,7 +448,7 @@ def test_get_child_images(self):
445448
ims = im.get_child_images()
446449

447450
assert len(ims) == 1
448-
assert_image_equal_tofile(ims[0], "Tests/images/flower_thumbnail.png")
451+
assert_image_similar_tofile(ims[0], "Tests/images/flower_thumbnail.png", 2.1)
449452

450453
def test_mp(self):
451454
with Image.open("Tests/images/pil_sample_rgb.jpg") as im:

Tests/test_file_tiff_metadata.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,22 @@ def test_writing_other_types_to_bytes(value, tmp_path):
216216
assert reloaded.tag_v2[700] == b"\x01"
217217

218218

219+
def test_writing_other_types_to_undefined(tmp_path):
220+
im = hopper()
221+
info = TiffImagePlugin.ImageFileDirectory_v2()
222+
223+
tag = TiffTags.TAGS_V2[33723]
224+
assert tag.type == TiffTags.UNDEFINED
225+
226+
info[33723] = 1
227+
228+
out = str(tmp_path / "temp.tiff")
229+
im.save(out, tiffinfo=info)
230+
231+
with Image.open(out) as reloaded:
232+
assert reloaded.tag_v2[33723] == b"1"
233+
234+
219235
def test_undefined_zero(tmp_path):
220236
# Check that the tag has not been changed since this test was created
221237
tag = TiffTags.TAGS_V2[45059]

docs/handbook/image-file-formats.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1126,7 +1126,7 @@ The :py:meth:`~PIL.Image.Image.save` method supports the following options:
11261126
If present and true, instructs the WebP writer to use lossless compression.
11271127

11281128
**quality**
1129-
Integer, 1-100, Defaults to 80. For lossy, 0 gives the smallest
1129+
Integer, 0-100, Defaults to 80. For lossy, 0 gives the smallest
11301130
size and 100 the largest. For lossless, this parameter is the amount
11311131
of effort put into the compression: 0 is the fastest, but gives larger
11321132
files compared to the slowest, but best, 100.
@@ -1147,6 +1147,10 @@ The :py:meth:`~PIL.Image.Image.save` method supports the following options:
11471147
The exif data to include in the saved file. Only supported if
11481148
the system WebP library was built with webpmux support.
11491149

1150+
**xmp**
1151+
The XMP data to include in the saved file. Only supported if
1152+
the system WebP library was built with webpmux support.
1153+
11501154
Saving sequences
11511155
~~~~~~~~~~~~~~~~
11521156

0 commit comments

Comments
 (0)