Merge branch 'master' into 4962-jpeg-zigzag

This commit is contained in:
Andrew Murray 2021-06-30 20:54:55 +10:00
commit d11c794997
466 changed files with 24424 additions and 17459 deletions

View File

@ -1,5 +1,4 @@
version: '{build}'
image: Visual Studio 2017
clone_folder: c:\pillow
init:
- ECHO %PYTHON%
@ -8,30 +7,32 @@ init:
environment:
EXECUTABLE: python.exe
PIP_DIR: Scripts
TEST_OPTIONS:
DEPLOY: YES
matrix:
- PYTHON: C:/Python38
- PYTHON: C:/Python39
ARCHITECTURE: x86
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
- PYTHON: C:/Python36-x64
ARCHITECTURE: x64
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
install:
- curl -fsSL -o pillow-depends.zip https://github.com/python-pillow/pillow-depends/archive/master.zip
- 7z x pillow-depends.zip -oc:\
- mv c:\pillow-depends-master c:\pillow-depends
- xcopy /s c:\pillow-depends\test_images\* c:\pillow\tests\images
- 7z x ..\pillow-depends\nasm-2.14.02-win64.zip -oc:\
- ..\pillow-depends\gs9533w32.exe /S
- path c:\nasm-2.14.02;C:\Program Files (x86)\gs\gs9.53.3\bin;%PATH%
- xcopy /S /Y c:\pillow-depends\test_images\* c:\pillow\tests\images
- 7z x ..\pillow-depends\nasm-2.15.05-win64.zip -oc:\
- ..\pillow-depends\gs9540w32.exe /S
- path c:\nasm-2.15.05;C:\Program Files (x86)\gs\gs9.54.0\bin;%PATH%
- cd c:\pillow\winbuild\
- ps: |
c:\python37\python.exe c:\pillow\winbuild\build_prepare.py -v --depends=C:\pillow-depends\
c:\pillow\winbuild\build\build_dep_all.cmd
$host.SetShouldExit(0)
- path C:\pillow\winbuild\build\bin;%PATH%
- '%PYTHON%\%EXECUTABLE% -m pip install -U setuptools'
build_script:
- ps: |
@ -42,13 +43,14 @@ build_script:
test_script:
- cd c:\pillow
- '%PYTHON%\%PIP_DIR%\pip.exe install pytest pytest-cov'
- '%PYTHON%\%EXECUTABLE% -m pip install pytest pytest-cov'
- c:\"Program Files (x86)"\"Windows Kits"\10\Debuggers\x86\gflags.exe /p /enable %PYTHON%\%EXECUTABLE%
- '%PYTHON%\%EXECUTABLE% -c "from PIL import Image"'
- '%PYTHON%\%EXECUTABLE% -m pytest -vx --cov PIL --cov Tests --cov-report term --cov-report xml Tests'
#- '%PYTHON%\%EXECUTABLE% test-installed.py -v -s %TEST_OPTIONS%' TODO TEST_OPTIONS with pytest?
after_test:
- pip install codecov
- python -m pip install codecov
- codecov --file coverage.xml --name %PYTHON% --flags AppVeyor
matrix:
@ -65,7 +67,7 @@ artifacts:
before_deploy:
- cd c:\pillow
- '%PYTHON%\%PIP_DIR%\pip.exe install wheel'
- '%PYTHON%\%EXECUTABLE% -m pip install wheel'
- cd c:\pillow\winbuild\
- c:\pillow\winbuild\build\build_pillow.cmd bdist_wheel
- cd c:\pillow

View File

@ -7,13 +7,3 @@ if [[ $MATRIX_DOCKER ]]; then
else
coverage xml
fi
if [[ $TRAVIS ]]; then
codecov --flags TravisCI
fi
if [ "$TRAVIS_PYTHON_VERSION" == "3.8" ]; then
# Coverage and quality reports on just the latest diff.
depends/diffcover-install.sh
depends/diffcover-run.sh
fi

View File

@ -21,35 +21,28 @@ sudo apt-get -qq install libfreetype6-dev liblcms2-dev python3-tk\
ghostscript libffi-dev libjpeg-turbo-progs libopenjp2-7-dev\
cmake imagemagick libharfbuzz-dev libfribidi-dev
if [[ $TRAVIS_CPU_ARCH == "s390x" ]]; then sudo chown $USER ~/.cache/pip/wheels ; fi
python3 -m pip install --upgrade pip
PYTHONOPTIMIZE=0 python3 -m pip install cffi
python3 -m pip install coverage
python3 -m pip install defusedxml
python3 -m pip install olefile
python3 -m pip install -U pytest
python3 -m pip install -U pytest-cov
python3 -m pip install -U pytest-timeout
python3 -m pip install pyroma
python3 -m pip install test-image-results
# TODO Remove condition when numpy supports 3.10
if ! [ "$GHA_PYTHON_VERSION" == "3.10-dev" ]; then python3 -m pip install numpy ; fi
pip install --upgrade pip
PYTHONOPTIMIZE=0 pip install cffi
pip install coverage
pip install olefile
pip install -U pytest
pip install -U pytest-cov
pip install pyroma
pip install test-image-results
pip install numpy
# TODO Remove when 3.8 / 3.9 / PyPy3 includes setuptools 49.3.2+:
if [ "$GHA_PYTHON_VERSION" == "3.8" ]; then pip install -U "setuptools>=49.3.2" ; fi
if [ "$GHA_PYTHON_VERSION" == "3.9" ]; then pip install -U "setuptools>=49.3.2" ; fi
if [ "$TRAVIS_PYTHON_VERSION" == "pypy3.6-7.3.1" ]; then pip install -U "setuptools>=49.3.2" ; fi
if [[ $TRAVIS_PYTHON_VERSION == 3.* ]]; then
# PyQt5 doesn't support PyPy3
# Wheel doesn't yet support 3.10
if [[ $GHA_PYTHON_VERSION == 3.* && $GHA_PYTHON_VERSION != "3.10-dev" ]]; then
# arm64, ppc64le, s390x CPUs:
# "ERROR: Could not find a version that satisfies the requirement pyqt5"
if [[ $TRAVIS_CPU_ARCH == "amd64" ]]; then
sudo apt-get -qq install libxcb-xinerama0 pyqt5-dev-tools
pip install pyqt5
fi
python3 -m pip install pyqt5
fi
# docs only on Python 3.8
if [ "$TRAVIS_PYTHON_VERSION" == "3.8" ]; then pip install -r requirements.txt ; fi
# webp
pushd depends && ./install_webp.sh && popd

View File

@ -2,9 +2,6 @@
set -e
python -bb -m pytest -v -x -W always --cov PIL --cov Tests --cov-report term Tests
python3 -c "from PIL import Image"
# Docs
if [ "$TRAVIS_PYTHON_VERSION" == "3.8" ] && [ "$TRAVIS_CPU_ARCH" == "amd64" ]; then
make doccheck
fi
python3 -bb -m pytest -v -x -W always --cov PIL --cov Tests --cov-report term Tests $REVERSE

20
.clang-format Normal file
View File

@ -0,0 +1,20 @@
# A clang-format style that approximates Python's PEP 7
# Useful for IDE integration
BasedOnStyle: Google
AlwaysBreakAfterReturnType: All
AllowShortIfStatementsOnASingleLine: false
AlignAfterOpenBracket: AlwaysBreak
BinPackArguments: false
BinPackParameters: false
BreakBeforeBraces: Attach
ColumnLimit: 88
DerivePointerAlignment: false
IndentWidth: 4
Language: Cpp
PointerAlignment: Right
ReflowComments: true
SortIncludes: false
SpaceBeforeParens: ControlStatements
SpacesInParentheses: false
TabWidth: 4
UseTab: Never

View File

@ -9,7 +9,7 @@ Please send a pull request to the master branch. Please include [documentation](
- Fork the Pillow repository.
- Create a branch from master.
- Develop bug fixes, features, tests, etc.
- Run the test suite. You can enable [Travis CI](https://travis-ci.org/profile/) and [AppVeyor](https://ci.appveyor.com/projects/new) on your repo to catch test failures prior to the pull request, and [Codecov](https://codecov.io/gh) to see if the changed code is covered by tests.
- Run the test suite. You can enable GitHub Actions (https://github.com/MY-USERNAME/Pillow/actions) and [AppVeyor](https://ci.appveyor.com/projects/new) on your repo to catch test failures prior to the pull request, and [Codecov](https://codecov.io/gh) to see if the changed code is covered by tests.
- Create a pull request to pull the changes from your branch to the Pillow master.
### Guidelines
@ -17,7 +17,8 @@ Please send a pull request to the master branch. Please include [documentation](
- Separate code commits from reformatting commits.
- Provide tests for any newly added code.
- Follow PEP 8.
- When committing only documentation changes please include [ci skip] in the commit message to avoid running tests on Travis-CI and AppVeyor.
- When committing only documentation changes please include `[ci skip]` in the commit message to avoid running tests on AppVeyor.
- Include [release notes](https://github.com/python-pillow/Pillow/tree/master/docs/releasenotes) as needed or appropriate with your bug fixes, feature additions and tests.
## Reporting Issues

1
.github/mergify.yml vendored
View File

@ -8,7 +8,6 @@ pull_request_rules:
- status-success=Docker Test Successful
- status-success=Windows Test Successful
- status-success=continuous-integration/appveyor/pr
- status-success=continuous-integration/travis-ci/pr
actions:
merge:
method: merge

26
.github/release-drafter.yml vendored Normal file
View File

@ -0,0 +1,26 @@
name-template: "$NEXT_MINOR_VERSION"
tag-template: "$NEXT_MINOR_VERSION"
change-template: '- $TITLE #$NUMBER [@$AUTHOR]'
categories:
- title: "Dependencies"
label: "Dependency"
- title: "Deprecations"
label: "Deprecation"
- title: "Documentation"
label: "Documentation"
- title: "Removals"
label: "Removal"
- title: "Testing"
label: "Testing"
exclude-labels:
- "changelog: skip"
template: |
https://pillow.readthedocs.io/en/stable/releasenotes/$NEXT_MINOR_VERSION.html
## Changes
$CHANGES

47
.github/workflows/cifuzz.yml vendored Normal file
View File

@ -0,0 +1,47 @@
name: CIFuzz
on:
push:
paths:
- "**.c"
- "**.h"
pull_request:
paths:
- "**.c"
- "**.h"
jobs:
Fuzzing:
runs-on: ubuntu-latest
steps:
- name: Build Fuzzers
id: build
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
with:
oss-fuzz-project-name: 'pillow'
language: python
dry-run: false
- name: Run Fuzzers
id: run
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
with:
oss-fuzz-project-name: 'pillow'
fuzz-seconds: 600
language: python
dry-run: false
- name: Upload New Crash
uses: actions/upload-artifact@v2
if: failure() && steps.build.outcome == 'success'
with:
name: artifacts
path: ./out/artifacts
- name: Upload Legacy Crash
uses: actions/upload-artifact@v2
if: steps.run.outcome == 'success'
with:
name: crash
path: ./out/crash*
- name: Fail on legacy crash
if: success()
run: |
[ ! -e out/crash-* ]
echo No legacy crash detected

View File

@ -34,12 +34,12 @@ jobs:
python-version: 3.8
- name: Build system information
run: python .github/workflows/system-info.py
run: python3 .github/workflows/system-info.py
- name: Install dependencies
run: |
python -m pip install -U pip
python -m pip install -U tox
python3 -m pip install -U pip
python3 -m pip install -U tox
- name: Lint
run: tox -e lint

View File

@ -2,22 +2,21 @@
set -e
brew install libtiff libjpeg openjpeg libimagequant webp little-cms2 freetype openblas
brew install libtiff libjpeg openjpeg libimagequant webp little-cms2 freetype openblas libraqm
PYTHONOPTIMIZE=0 pip install cffi
pip install coverage
pip install olefile
pip install -U pytest
pip install -U pytest-cov
pip install pyroma
pip install test-image-results
PYTHONOPTIMIZE=0 python3 -m pip install cffi
python3 -m pip install coverage
python3 -m pip install defusedxml
python3 -m pip install olefile
python3 -m pip install -U pytest
python3 -m pip install -U pytest-cov
python3 -m pip install -U pytest-timeout
python3 -m pip install pyroma
python3 -m pip install test-image-results
echo -e "[openblas]\nlibraries = openblas\nlibrary_dirs = /usr/local/opt/openblas/lib" >> ~/.numpy-site.cfg
pip install numpy
# TODO Remove when 3.8 / 3.9 includes setuptools 49.3.2+:
if [ "$GHA_PYTHON_VERSION" == "3.8" ]; then pip install -U "setuptools>=49.3.2" ; fi
if [ "$GHA_PYTHON_VERSION" == "3.9" ]; then pip install -U "setuptools>=49.3.2" ; fi
# TODO Remove condition when numpy supports 3.10
if ! [ "$GHA_PYTHON_VERSION" == "3.10-dev" ]; then python3 -m pip install numpy ; fi
# extra test images
pushd depends && ./install_extra_test_images.sh && popd

17
.github/workflows/release-drafter.yml vendored Normal file
View File

@ -0,0 +1,17 @@
name: Release drafter
on:
push:
# branches to consider in the event; optional, defaults to all
branches:
- master
jobs:
update_release_draft:
if: github.repository == 'python-pillow/Pillow'
runs-on: ubuntu-latest
steps:
# Drafts your next release notes as pull requests are merged into "master"
- uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@ -10,19 +10,30 @@ jobs:
fail-fast: false
matrix:
docker: [
# Run slower jobs first to give them a headstart and reduce waiting time
ubuntu-20.04-focal-arm64v8,
ubuntu-20.04-focal-ppc64le,
ubuntu-20.04-focal-s390x,
# Then run the remainder
alpine,
amazon-2-amd64,
arch,
ubuntu-18.04-bionic-amd64,
ubuntu-20.04-focal-amd64,
debian-10-buster-x86,
centos-6-amd64,
centos-7-amd64,
centos-8-amd64,
amazon-1-amd64,
amazon-2-amd64,
fedora-32-amd64,
debian-10-buster-x86,
fedora-33-amd64,
fedora-34-amd64,
ubuntu-18.04-bionic-amd64,
ubuntu-20.04-focal-amd64,
]
dockerTag: [master]
include:
- docker: "ubuntu-20.04-focal-arm64v8"
qemu-arch: "aarch64"
- docker: "ubuntu-20.04-focal-ppc64le"
qemu-arch: "ppc64le"
- docker: "ubuntu-20.04-focal-s390x"
qemu-arch: "s390x"
name: ${{ matrix.docker }}
@ -30,7 +41,12 @@ jobs:
- uses: actions/checkout@v2
- name: Build system information
run: python .github/workflows/system-info.py
run: python3 .github/workflows/system-info.py
- name: Set up QEMU
if: "matrix.qemu-arch"
run: |
docker run --rm --privileged aptman/qus -s -- -p ${{ matrix.qemu-arch }}
- name: Docker pull
run: |

52
.github/workflows/test-valgrind.yml vendored Normal file
View File

@ -0,0 +1,52 @@
name: Test Valgrind
# like the docker tests, but running valgrind only on *.c/*.h changes.
on:
push:
paths:
- "**.c"
- "**.h"
pull_request:
paths:
- "**.c"
- "**.h"
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
docker: [
ubuntu-20.04-focal-amd64-valgrind,
]
dockerTag: [master]
name: ${{ matrix.docker }}
steps:
- uses: actions/checkout@v2
- name: Build system information
run: python3 .github/workflows/system-info.py
- name: Docker pull
run: |
docker pull pythonpillow/${{ matrix.docker }}:${{ matrix.dockerTag }}
- name: Build and Run Valgrind
run: |
# The Pillow user in the docker container is UID 1000
sudo chown -R 1000 $GITHUB_WORKSPACE
docker run --name pillow_container -v $GITHUB_WORKSPACE:/Pillow pythonpillow/${{ matrix.docker }}:${{ matrix.dockerTag }}
sudo chown -R runner $GITHUB_WORKSPACE
success:
needs: build
runs-on: ubuntu-latest
name: Valgrind Test Successful
steps:
- name: Success
run: echo Valgrind Test Successful

View File

@ -8,18 +8,14 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.6", "3.7", "3.8", "3.9", "pypy3"]
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10-dev"]
architecture: ["x86", "x64"]
include:
- architecture: "x86"
platform-vcvars: "x86"
platform-msbuild: "Win32"
- architecture: "x64"
platform-vcvars: "x86_amd64"
platform-msbuild: "x64"
exclude:
# PyPy does not support 64-bit on Windows
- python-version: "pypy3"
# PyPy3.6 only ships 32-bit binaries for Windows
- python-version: "pypy-3.6"
architecture: "x86"
# PyPy 7.3.4+ only ships 64-bit binaries for Windows
- python-version: "pypy-3.7"
architecture: "x64"
timeout-minutes: 30
@ -55,23 +51,22 @@ jobs:
- name: Print build system information
run: python .github/workflows/system-info.py
- name: pip install wheel pytest pytest-cov
run: python -m pip install wheel pytest pytest-cov
# TODO Remove when 3.8 / 3.9 includes setuptools 49.3.2+:
- name: Upgrade setuptools
if: "contains(matrix.python-version, '3.8') || contains(matrix.python-version, '3.9')"
run: python -m pip install -U "setuptools>=49.3.2"
- name: python -m pip install wheel pytest pytest-cov pytest-timeout defusedxml
run: python -m pip install wheel pytest pytest-cov pytest-timeout defusedxml
- name: Install dependencies
id: install
run: |
7z x winbuild\depends\nasm-2.14.02-win64.zip "-o$env:RUNNER_WORKSPACE\"
echo "$env:RUNNER_WORKSPACE\nasm-2.14.02" >> $env:GITHUB_PATH
7z x winbuild\depends\nasm-2.15.05-win64.zip "-o$env:RUNNER_WORKSPACE\"
echo "$env:RUNNER_WORKSPACE\nasm-2.15.05" >> $env:GITHUB_PATH
winbuild\depends\gs9533w32.exe /S
echo "C:\Program Files (x86)\gs\gs9.53.3\bin" >> $env:GITHUB_PATH
winbuild\depends\gs9540w32.exe /S
echo "C:\Program Files (x86)\gs\gs9.54.0\bin" >> $env:GITHUB_PATH
xcopy /s winbuild\depends\test_images\* Tests\images\
xcopy /S /Y winbuild\depends\test_images\* Tests\images\
# make cache key depend on VS version
& "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" | find """catalog_buildVersion""" | ForEach-Object { $a = $_.split(" ")[1]; echo "::set-output name=vs::$a" }
shell: pwsh
- name: Cache build
@ -80,7 +75,7 @@ jobs:
with:
path: winbuild\build
key:
${{ hashFiles('winbuild\build_prepare.py') }}-${{ hashFiles('.github\workflows\test-windows.yml') }}-${{ env.pythonLocation }}
${{ hashFiles('winbuild\build_prepare.py') }}-${{ hashFiles('.github\workflows\test-windows.yml') }}-${{ env.pythonLocation }}-${{ steps.install.outputs.vs }}
- name: Prepare build
if: steps.build-cache.outputs.cache-hit != 'true'
@ -91,25 +86,32 @@ jobs:
- name: Build dependencies / libjpeg-turbo
if: steps.build-cache.outputs.cache-hit != 'true'
run: "& winbuild\\build\\build_dep_libjpeg.cmd"
- name: Build dependencies / zlib
if: steps.build-cache.outputs.cache-hit != 'true'
run: "& winbuild\\build\\build_dep_zlib.cmd"
- name: Build dependencies / LibTiff
if: steps.build-cache.outputs.cache-hit != 'true'
run: "& winbuild\\build\\build_dep_libtiff.cmd"
- name: Build dependencies / WebP
if: steps.build-cache.outputs.cache-hit != 'true'
run: "& winbuild\\build\\build_dep_libwebp.cmd"
# for FreeType CBDT font support
# for FreeType CBDT/SBIX font support
- name: Build dependencies / libpng
if: steps.build-cache.outputs.cache-hit != 'true'
run: "& winbuild\\build\\build_dep_libpng.cmd"
- name: Build dependencies / FreeType
if: steps.build-cache.outputs.cache-hit != 'true'
run: "& winbuild\\build\\build_dep_freetype.cmd"
- name: Build dependencies / LCMS2
if: steps.build-cache.outputs.cache-hit != 'true'
run: "& winbuild\\build\\build_dep_lcms2.cmd"
- name: Build dependencies / OpenJPEG
if: steps.build-cache.outputs.cache-hit != 'true'
run: "& winbuild\\build\\build_dep_openjpeg.cmd"
@ -123,12 +125,11 @@ jobs:
- name: Build dependencies / HarfBuzz
if: steps.build-cache.outputs.cache-hit != 'true'
run: "& winbuild\\build\\build_dep_harfbuzz.cmd"
# Raqm dependencies
- name: Build dependencies / FriBidi
if: steps.build-cache.outputs.cache-hit != 'true'
run: "& winbuild\\build\\build_dep_fribidi.cmd"
- name: Build dependencies / Raqm
if: steps.build-cache.outputs.cache-hit != 'true'
run: "& winbuild\\build\\build_dep_libraqm.cmd"
# trim ~150MB x 9
- name: Optimize build cache
@ -159,7 +160,7 @@ jobs:
if: failure()
run: |
mkdir -p Tests/errors
shell: pwsh
shell: bash
- name: Upload errors
uses: actions/upload-artifact@v2
@ -234,8 +235,6 @@ jobs:
${{ matrix.package }}-python3-olefile \
${{ matrix.package }}-python3-pip \
${{ matrix.package }}-python3-pyqt5 \
${{ matrix.package }}-python3-pytest \
${{ matrix.package }}-python3-pytest-cov \
${{ matrix.package }}-python3-setuptools \
${{ matrix.package }}-freetype \
${{ matrix.package }}-ghostscript \
@ -248,7 +247,7 @@ jobs:
${{ matrix.package }}-openjpeg2 \
subversion
python3 -m pip install pyroma
python3 -m pip install pyroma pytest pytest-cov
pushd depends && ./install_extra_test_images.sh && popd
@ -258,6 +257,7 @@ jobs:
- name: Test Pillow
run: |
python3 selftest.py --installed
python3 -c "from PIL import Image"
python3 -m pytest -vx --cov PIL --cov Tests --cov-report term --cov-report xml Tests
- name: Upload coverage

View File

@ -13,7 +13,9 @@ jobs:
"macOS-latest",
]
python-version: [
"pypy3",
"pypy-3.7",
"pypy-3.6",
"3.10-dev",
"3.9",
"3.8",
"3.7",
@ -21,9 +23,10 @@ jobs:
]
include:
- python-version: "3.6"
env: PYTHONOPTIMIZE=1
PYTHONOPTIMIZE: 1
REVERSE: "--reverse"
- python-version: "3.7"
env: PYTHONOPTIMIZE=2
PYTHONOPTIMIZE: 2
# Include new variables for Codecov
- os: ubuntu-latest
codecov-flag: GHA_Ubuntu
@ -44,7 +47,7 @@ jobs:
- name: Get pip cache dir
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"
echo "::set-output name=dir::$(python3 -m pip cache dir)"
- name: pip cache
uses: actions/cache@v2
@ -56,7 +59,7 @@ jobs:
${{ matrix.os }}-${{ matrix.python-version }}-
- name: Build system information
run: python .github/workflows/system-info.py
run: python3 .github/workflows/system-info.py
- name: Install Linux dependencies
if: startsWith(matrix.os, 'ubuntu')
@ -78,13 +81,22 @@ jobs:
- name: Test
run: |
.ci/test.sh
if [ $REVERSE ]; then
python3 -m pip install pytest-reverse
fi
if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then
xvfb-run -s '-screen 0 1024x768x24' .ci/test.sh
else
.ci/test.sh
fi
env:
PYTHONOPTIMIZE: ${{ matrix.PYTHONOPTIMIZE }}
REVERSE: ${{ matrix.REVERSE }}
- name: Prepare to upload errors
if: failure()
run: |
mkdir -p Tests/errors
shell: pwsh
- name: Upload errors
uses: actions/upload-artifact@v2
@ -94,9 +106,9 @@ jobs:
path: Tests/errors
- name: Docs
if: startsWith(matrix.os, 'ubuntu') && matrix.python-version == 3.8
if: startsWith(matrix.os, 'ubuntu') && matrix.python-version == 3.9
run: |
pip install sphinx-removed-in sphinx-rtd-theme
python3 -m pip install sphinx-copybutton sphinx-issues sphinx-removed-in sphinx-rtd-theme sphinxext-opengraph
make doccheck
- name: After success

7
.gitignore vendored
View File

@ -81,6 +81,13 @@ docs/_build/
# Extra test images installed from pillow-depends/test_images
Tests/images/README.md
Tests/images/crash_1.tif
Tests/images/crash_2.tif
Tests/images/string_dimension.tiff
Tests/images/jpeg2000
Tests/images/msp
Tests/images/picins
Tests/images/sunraster
# pyinstaller
*.spec

View File

@ -8,7 +8,7 @@ repos:
files: \.py$
types: []
- repo: https://github.com/timothycrosley/isort
- repo: https://github.com/PyCQA/isort
rev: 377d260ffa6f746693f97b46d95025afc4bd8275 # frozen: 5.4.2
hooks:
- id: isort

View File

@ -1,70 +0,0 @@
dist: xenial
language: python
cache:
pip: true
directories:
- $HOME/.cache/pre-commit
notifications:
irc: "chat.freenode.net#pil"
# Run fast lint first to get fast feedback.
# Run slower CPUs next, to give them a headstart and reduce waiting time.
# Then run the remainder.
matrix:
fast_finish: true
include:
- python: "3.6"
name: "Lint"
env: LINT="true"
- python: "3.6"
arch: arm64
- python: "3.7"
arch: ppc64le
- python: "3.8"
arch: s390x
- python: "pypy3.6-7.3.1"
name: "PyPy3 Xenial"
- python: "3.9-dev"
name: "3.9-dev Xenial"
services: xvfb
- python: "3.8"
name: "3.8 Xenial"
services: xvfb
- python: '3.7'
name: "3.7 Xenial PYTHONOPTIMIZE=2"
env: PYTHONOPTIMIZE=2
services: xvfb
- python: '3.6'
name: "3.6 Xenial PYTHONOPTIMIZE=1"
env: PYTHONOPTIMIZE=1
services: xvfb
allow_failures:
- python: "3.9-dev"
install:
- |
if [ "$LINT" == "true" ]; then
pip install tox
else
.ci/install.sh;
fi
script:
- |
if [ "$LINT" == "true" ]; then
tox -e lint
else
.ci/build.sh
.ci/test.sh
fi
after_success:
- |
if [ "$LINT" == "" ]; then
.ci/after_success.sh
fi

View File

@ -2,12 +2,366 @@
Changelog (Pillow)
==================
8.1.0 (unreleased)
8.3.0 (unreleased)
------------------
- Replaced xml.etree.ElementTree #5565
[radarhere]
- Moved CVE image to pillow-depends #5561
[radarhere]
- Added tag data for IFD groups #5554
[radarhere]
- Improved ImagePalette #5552
[radarhere]
- Add DDS saving #5402
[radarhere]
- Improved getxmp() #5455
[radarhere]
- Convert to float for comparison with float in IFDRational __eq__ #5412
[radarhere]
- Allow getexif() to access TIFF tag_v2 data #5416
[radarhere]
- Read FITS image mode and size #5405
[radarhere]
- Merge parallel horizontal edges in ImagingDrawPolygon #5347
[radarhere, hrdrq]
- Use transparency behind first GIF frame and when disposing to background #5557
[radarhere, zewt]
- Avoid unstable nature of qsort in Quant.c #5367
[radarhere]
- Copy palette to new images in ImageOps expand #5551
[radarhere]
- Ensure palette string matches RGB mode #5549
[radarhere]
- Do not modify EXIF of original image instance in exif_transpose() #5547
[radarhere]
- Fixed default numresolution for small JPEG2000 images #5540
[radarhere]
- Added DDS BC5 reading #5501
[radarhere]
- Raise an error if ImageDraw.textbbox is used without a TrueType font #5510
[radarhere]
- Added ICO saving in BMP format #5513
[radarhere]
- Ensure PNG seeks to end of previous chunk at start of load_end #5493
[radarhere]
- Do not allow TIFF to seek to a past frame #5473
[radarhere]
- Avoid race condition when displaying images with eog #5507
[mconst]
- Added specific error messages when ink has incorrect number of bands #5504
[radarhere]
- Allow converting an image to a numpy array to raise errors #5379
[radarhere]
- Removed DPI rounding from BMP, JPEG, PNG and WMF loading #5476, #5470
[radarhere]
- Remove spikes when drawing thin pieslices #5460
[xtsm]
- Updated default value for SAMPLESPERPIXEL TIFF tag #5452
[radarhere]
- Removed TIFF DPI rounding #5446
[radarhere, hugovk]
- Include code in WebP error #5471
[radarhere]
- Do not alter pixels outside mask when drawing text on an image with transparency #5434
[radarhere]
- Reset handle when seeking backwards in TIFF #5443
[radarhere]
- Replace sys.stdout with sys.stdout.buffer when saving #5437
[radarhere]
- Fixed UNDEFINED TIFF tag of length 0 being changed in roundtrip #5426
[radarhere]
- Fixed bug when checking FreeType2 version if it is not installed #5445
[radarhere]
- Do not round dimensions when saving PDF #5459
[radarhere]
- Added ImageOps contain() #5417
[radarhere, hugovk]
- Changed WebP default "method" value to 4 #5450
[radarhere]
- Switched to saving 1-bit PDFs with DCTDecode #5430
[radarhere]
- Use bpp from ICO header #5429
[radarhere]
- Corrected JPEG APP14 transform value #5408
[radarhere]
- Changed TIFF tag 33723 length to 1 #5425
[radarhere]
- Changed ImageMorph incorrect mode errors to ValueError #5414
[radarhere]
- Add EXIF tags specified in EXIF 2.32 #5419
[gladiusglad]
- Treat previous contents of first GIF frame as transparent #5391
[radarhere]
- For special image modes, revert default resize resampling to NEAREST #5411
[radarhere]
- JPEG2000: Support decoding subsampled RGB and YCbCr images #4996
[nulano, radarhere]
- Stop decoding BC1 punchthrough alpha in BC2&3 #4144
[jansol]
- Use zero if GIF background color index is missing #5390
[radarhere]
- Fixed ensuring that GIF previous frame was loaded #5386
[radarhere]
- Valgrind fixes #5397
[wiredfool]
- Round down the radius in rounded_rectangle #5382
[radarhere]
- Fixed reading uncompressed RGB data from DDS #5383
[radarhere]
8.2.0 (2021-04-01)
------------------
- Added getxmp() method #5144
[UrielMaD, radarhere]
- Add ImageShow support for GraphicsMagick #5349
[latosha-maltba, radarhere]
- Do not load transparent pixels from subsequent GIF frames #5333
[zewt, radarhere]
- Use LZW encoding when saving GIF images #5291
[raygard]
- Set all transparent colors to be equal in quantize() #5282
[radarhere]
- Allow PixelAccess to use Python __int__ when parsing x and y #5206
[radarhere]
- Removed Image._MODEINFO #5316
[radarhere]
- Add preserve_tone option to autocontrast #5350
[elejke, radarhere]
- Fixed linear_gradient and radial_gradient I and F modes #5274
[radarhere]
- Add support for reading TIFFs with PlanarConfiguration=2 #5364
[kkopachev, wiredfool, nulano]
- Deprecated categories #5351
[radarhere]
- Do not premultiply alpha when resizing with Image.NEAREST resampling #5304
[nulano]
- Dynamically link FriBiDi instead of Raqm #5062
[nulano]
- Allow fewer PNG palette entries than the bit depth maximum when saving #5330
[radarhere]
- Use duration from info dictionary when saving WebP #5338
[radarhere]
- Stop flattening EXIF IFD into getexif() #4947
[radarhere, kkopachev]
- Replaced tiff_deflate with tiff_adobe_deflate compression when saving TIFF images #5343
[radarhere]
- Save ICC profile from TIFF encoderinfo #5321
[radarhere]
- Moved RGB fix inside ImageQt class #5268
[radarhere]
- Allow alpha_composite destination to be negative #5313
[radarhere]
- Ensure file is closed if it is opened by ImageQt.ImageQt #5260
[radarhere]
- Added ImageDraw rounded_rectangle method #5208
[radarhere]
- Added IPythonViewer #5289
[radarhere, Kipkurui-mutai]
- Only draw each rectangle outline pixel once #5183
[radarhere]
- Use mmap instead of built-in Win32 mapper #5224
[radarhere, cgohlke]
- Handle PCX images with an odd stride #5214
[radarhere]
- Only read different sizes for "Large Thumbnail" MPO frames #5168
[radarhere]
- Added PyQt6 support #5258
[radarhere]
- Changed Image.open formats parameter to be case-insensitive #5250
[Piolie, radarhere]
- Deprecate Tk/Tcl 8.4, to be removed in Pillow 10 (2023-01-02) #5216
[radarhere]
- Added tk version to pilinfo #5226
[radarhere, nulano]
- Support for ignoring tests when running valgrind #5150
[wiredfool, radarhere, hugovk]
- OSS-Fuzz support #5189
[wiredfool, radarhere]
8.1.2 (2021-03-06)
------------------
- Fix Memory DOS in BLP (CVE-2021-27921), ICNS (CVE-2021-27922) and ICO (CVE-2021-27923) Image Plugins
[wiredfool]
8.1.1 (2021-03-01)
------------------
- Use more specific regex chars to prevent ReDoS. CVE-2021-25292
[hugovk]
- Fix OOB Read in TiffDecode.c, and check the tile validity before reading. CVE-2021-25291
[wiredfool]
- Fix negative size read in TiffDecode.c. CVE-2021-25290
[wiredfool]
- Fix OOB read in SgiRleDecode.c. CVE-2021-25293
[wiredfool]
- Incorrect error code checking in TiffDecode.c. CVE-2021-25289
[wiredfool]
- PyModule_AddObject fix for Python 3.10 #5194
[radarhere]
8.1.0 (2021-01-02)
------------------
- Fix TIFF OOB Write error. CVE-2020-35654 #5175
[wiredfool]
- Fix for Read Overflow in PCX Decoding. CVE-2020-35653 #5174
[wiredfool, radarhere]
- Fix for SGI Decode buffer overrun. CVE-2020-35655 #5173
[wiredfool, radarhere]
- Fix OOB Read when saving GIF of xsize=1 #5149
[wiredfool]
- Makefile updates #5159
[wiredfool, radarhere]
- Add support for PySide6 #5161
[hugovk]
- Use disposal settings from previous frame in APNG #5126
[radarhere]
- Added exception explaining that _repr_png_ saves to PNG #5139
[radarhere]
- Use previous disposal method in GIF load_end #5125
[radarhere]
- Allow putpalette to accept 1024 integers to include alpha values #5089
[radarhere]
- Fix OOB Read when writing TIFF with custom Metadata #5148
[wiredfool]
- Added append_images support for ICO #4568
[ziplantil, radarhere]
- Block TIFFTAG_SUBIFD #5120
[radarhere]
- Fixed dereferencing potential null pointers #5108, #5111
[cgohlke, radarhere]
- Deprecate FreeType 2.7 #5098
[hugovk, radarhere]
- Moved warning to end of execution #4965
[radarhere]
- Removed unused fromstring and tostring C methods #5026
[radarhere]
- init() if one of the formats is unrecognised #5037
[radarhere]
- Moved string_dimension CVE image to pillow-depends #4993
[radarhere]
- Support raw rgba8888 for DDS #4760
[qiankanglai]
8.0.1 (2020-10-22)
------------------
- Update FreeType used in binary wheels to 2.10.4 to fix CVE-2020-15999.
[radarhere]
- Moved string_dimension image to pillow-depends #4993
[radarhere]
8.0.0 (2020-10-15)
------------------
@ -4030,8 +4384,8 @@ Changelog (Pillow)
1.0 (07/30/2010)
----------------
- Remove support for ``import Image``, etc. from the standard namespace. ``from PIL import Image`` etc. now required.
- Forked PIL based on `Hanno Schlichting's re-packaging <https://dist.plone.org/thirdparty/PIL-1.1.7.tar.gz>`_
- Remove support for ``import Image``. ``from PIL import Image`` now required.
- Forked PIL based on `Chris McDonough and Hanno Schlichting's setuptools compatible re-packaging <https://dist.plone.org/thirdparty/PIL-1.1.7.tar.gz>`_
[aclark4life]
Pre-fork

View File

@ -5,9 +5,9 @@ The Python Imaging Library (PIL) is
Pillow is the friendly PIL fork. It is
Copyright © 2010-2020 by Alex Clark and contributors
Copyright © 2010-2021 by Alex Clark and contributors
Like PIL, Pillow is licensed under the open source PIL Software License:
Like PIL, Pillow is licensed under the open source HPND License:
By obtaining, using, and/or copying this software and/or its associated
documentation, you agree that you have read, understood, and will comply

View File

@ -18,6 +18,7 @@ graft docs
# build/src control detritus
exclude .appveyor.yml
exclude .clang-format
exclude .coveragerc
exclude .editorconfig
exclude .readthedocs.yml

View File

@ -1,4 +1,4 @@
.DEFAULT_GOAL := release-test
.DEFAULT_GOAL := help
.PHONY: clean
clean:
@ -7,13 +7,6 @@ clean:
rm -r build || true
find . -name __pycache__ | xargs rm -r || true
BRANCHES=`git branch -a | grep -v HEAD | grep -v master | grep remote`
.PHONY: co
co:
-for i in $(BRANCHES) ; do \
git checkout -t $$i ; \
done
.PHONY: coverage
coverage:
pytest -qq
@ -33,7 +26,7 @@ doccheck:
.PHONY: docserve
docserve:
cd docs/_build/html && python3 -mSimpleHTTPServer 2> /dev/null&
cd docs/_build/html && python3 -m http.server 2> /dev/null&
.PHONY: help
help:
@ -47,7 +40,9 @@ help:
@echo " install make and install"
@echo " install-coverage make and install with C coverage"
@echo " install-req install documentation and test dependencies"
@echo " install-venv install in virtualenv"
@echo " install-venv (deprecated) install in virtualenv"
@echo " lint run the lint checks"
@echo " lint-fix run black and isort to (mostly) fix lint issues."
@echo " release-test run code and package tests before release"
@echo " test run tests on installed pillow"
@echo " upload build and upload sdists to PyPI"
@ -81,6 +76,7 @@ install-req:
.PHONY: install-venv
install-venv:
echo "'install-venv' is deprecated and will be removed in a future Pillow release"
virtualenv .
bin/pip install -r requirements.txt
@ -91,10 +87,12 @@ release-test:
python3 selftest.py
python3 -m pytest Tests
python3 setup.py install
-rm dist/*.egg
-rmdir dist
python3 -m pytest -qq
check-manifest
pyroma .
viewdoc
$(MAKE) readme
.PHONY: sdist
sdist:
@ -104,6 +102,24 @@ sdist:
test:
pytest -qq
.PHONY: valgrind
valgrind:
python3 -c "import pytest_valgrind" || pip3 install pytest-valgrind
PYTHONMALLOC=malloc valgrind --suppressions=Tests/oss-fuzz/python.supp --leak-check=no \
--log-file=/tmp/valgrind-output \
python3 -m pytest --no-memcheck -vv --valgrind --valgrind-log=/tmp/valgrind-output
.PHONY: readme
readme:
viewdoc
python3 setup.py --long-description | markdown2 > .long-description.html && open .long-description.html
.PHONY: lint
lint:
tox --help > /dev/null || python3 -m pip install tox
tox -e lint
.PHONY: lint-fix
lint-fix:
black --target-version py36 .
isort .

View File

@ -24,15 +24,6 @@ As of 2019, Pillow development is
<tr>
<th>tests</th>
<td>
<a href="https://travis-ci.org/python-pillow/Pillow"><img
alt="Travis CI build status (Linux)"
src="https://img.shields.io/travis/python-pillow/Pillow/master.svg?label=Linux%20build"></a>
<a href="https://travis-ci.org/python-pillow/pillow-wheels"><img
alt="Travis CI build status (macOS)"
src="https://img.shields.io/travis/python-pillow/pillow-wheels/master.svg?label=macOS%20build"></a>
<a href="https://ci.appveyor.com/project/python-pillow/Pillow"><img
alt="AppVeyor CI build status (Windows)"
src="https://img.shields.io/appveyor/build/python-pillow/Pillow/master.svg?label=Windows%20build"></a>
<a href="https://github.com/python-pillow/Pillow/actions?query=workflow%3ALint"><img
alt="GitHub Actions build status (Lint)"
src="https://github.com/python-pillow/Pillow/workflows/Lint/badge.svg"></a>
@ -45,6 +36,15 @@ As of 2019, Pillow development is
<a href="https://github.com/python-pillow/Pillow/actions?query=workflow%3A%22Test+Docker%22"><img
alt="GitHub Actions build status (Test Docker)"
src="https://github.com/python-pillow/Pillow/workflows/Test%20Docker/badge.svg"></a>
<a href="https://ci.appveyor.com/project/python-pillow/Pillow"><img
alt="AppVeyor CI build status (Windows)"
src="https://img.shields.io/appveyor/build/python-pillow/Pillow/master.svg?label=Windows%20build"></a>
<a href="https://github.com/python-pillow/pillow-wheels/actions"><img
alt="GitHub Actions wheels build status (Wheels)"
src="https://github.com/python-pillow/pillow-wheels/workflows/Wheels/badge.svg"></a>
<a href="https://travis-ci.com/github/python-pillow/pillow-wheels"><img
alt="Travis CI wheels build status (aarch64)"
src="https://img.shields.io/travis/com/python-pillow/pillow-wheels/master.svg?label=aarch64%20wheels"></a>
<a href="https://codecov.io/gh/python-pillow/Pillow"><img
alt="Code coverage"
src="https://codecov.io/gh/python-pillow/Pillow/branch/master/graph/badge.svg"></a>
@ -96,6 +96,7 @@ The core image library is designed for fast access to data stored in a few basic
- [Contribute](https://github.com/python-pillow/Pillow/blob/master/.github/CONTRIBUTING.md)
- [Issues](https://github.com/python-pillow/Pillow/issues)
- [Pull requests](https://github.com/python-pillow/Pillow/pulls)
- [Release notes](https://pillow.readthedocs.io/en/stable/releasenotes/index.html)
- [Changelog](https://github.com/python-pillow/Pillow/blob/master/CHANGES.rst)
- [Pre-fork](https://github.com/python-pillow/Pillow/blob/master/CHANGES.rst#pre-fork)

View File

@ -1,16 +1,16 @@
# Release Checklist
See https://pillow.readthedocs.io/en/stable/releasenotes/versioning.html for
information about how the version numbers line up with releases.
## Main Release
Released quarterly on January 2nd, April 1st, July 1st and October 15th.
* [ ] Open a release ticket e.g. https://github.com/python-pillow/Pillow/issues/3154
* [ ] Develop and prepare release in `master` branch.
* [ ] Check [GitHub Actions](https://github.com/python-pillow/Pillow/actions),
[Travis CI](https://travis-ci.org/github/python-pillow/Pillow) and
[AppVeyor](https://ci.appveyor.com/project/python-pillow/Pillow) to confirm
passing tests in `master` branch.
* [ ] Check that all of the wheel builds [Pillow Wheel Builder](https://github.com/python-pillow/pillow-wheels) pass the tests in Travis CI.
* [ ] Check [GitHub Actions](https://github.com/python-pillow/Pillow/actions) and [AppVeyor](https://ci.appveyor.com/project/python-pillow/Pillow) to confirm passing tests in `master` branch.
* [ ] Check that all of the wheel builds [Pillow Wheel Builder](https://github.com/python-pillow/pillow-wheels) pass the tests in Travis CI and GitHub Actions.
* [ ] In compliance with [PEP 440](https://www.python.org/dev/peps/pep-0440/), update version identifier in `src/PIL/_version.py`
* [ ] Update `CHANGES.rst`.
* [ ] Run pre-release check via `make release-test` in a freshly cloned repo.
@ -21,13 +21,18 @@ Released quarterly on January 2nd, April 1st, July 1st and October 15th.
git push --all
git push --tags
```
* [ ] Create source distributions e.g.:
* [ ] Create and check source distribution:
```bash
make sdist
twine check dist/*
```
* [ ] Create [binary distributions](https://github.com/python-pillow/Pillow/blob/master/RELEASING.md#binary-distributions)
* [ ] Upload all binaries and source distributions e.g. `twine upload dist/Pillow-5.2.0*`
* [ ] Create a [new release on GitHub](https://github.com/python-pillow/Pillow/releases/new)
* [ ] Check and upload all binaries and source distributions e.g.:
```bash
twine check dist/*
twine upload dist/Pillow-5.2.0*
```
* [ ] Publish the [release on GitHub](https://github.com/python-pillow/Pillow/releases)
* [ ] In compliance with [PEP 440](https://www.python.org/dev/peps/pep-0440/), increment and append `.dev0` to version identifier in `src/PIL/_version.py`
## Point Release
@ -40,14 +45,11 @@ Released as needed for security, installation or critical bug fixes.
```bash
git checkout -t remotes/origin/5.2.x
```
* [ ] Cherry pick individual commits from `master` branch to release branch e.g. `5.2.x`.
* [ ] Cherry pick individual commits from `master` branch to release branch e.g. `5.2.x`, then `git push`.
* [ ] Check [GitHub Actions](https://github.com/python-pillow/Pillow/actions),
[Travis CI](https://travis-ci.org/github/python-pillow/Pillow) and
[AppVeyor](https://ci.appveyor.com/project/python-pillow/Pillow) to confirm
passing tests in release branch e.g. `5.2.x`.
* [ ] Check [GitHub Actions](https://github.com/python-pillow/Pillow/actions) and [AppVeyor](https://ci.appveyor.com/project/python-pillow/Pillow) to confirm passing tests in release branch e.g. `5.2.x`.
* [ ] In compliance with [PEP 440](https://www.python.org/dev/peps/pep-0440/), update version identifier in `src/PIL/_version.py`
* [ ] Run pre-release check via `make release-test`.
* [ ] Create tag for release e.g.:
@ -56,13 +58,18 @@ Released as needed for security, installation or critical bug fixes.
git push
git push --tags
```
* [ ] Create source distributions e.g.:
* [ ] Create and check source distribution:
```bash
make sdist
twine check dist/*
```
* [ ] Create [binary distributions](https://github.com/python-pillow/Pillow/blob/master/RELEASING.md#binary-distributions)
* [ ] Upload all binaries and source distributions e.g. `twine upload dist/Pillow-5.2.1*`
* [ ] Create a [new release on GitHub](https://github.com/python-pillow/Pillow/releases/new)
* [ ] Check and upload all binaries and source distributions e.g.:
```bash
twine check dist/*
twine upload dist/Pillow-5.2.1*
```
* [ ] Publish the [release on GitHub](https://github.com/python-pillow/Pillow/releases)
## Embargoed Release
@ -81,18 +88,19 @@ Released as needed privately to individual vendors for critical security-related
git push origin 2.5.x
git push origin --tags
```
* [ ] Create source distributions e.g.:
* [ ] Create and check source distribution:
```bash
make sdist
twine check dist/*
```
* [ ] Create [binary distributions](https://github.com/python-pillow/Pillow/blob/master/RELEASING.md#binary-distributions)
* [ ] Create a [new release on GitHub](https://github.com/python-pillow/Pillow/releases/new)
* [ ] Publish the [release on GitHub](https://github.com/python-pillow/Pillow/releases)
## Binary Distributions
### Windows
* [ ] Contact `@cgohlke` for Windows binaries via release ticket e.g. https://github.com/python-pillow/Pillow/issues/1174.
* [ ] Download and extract tarball from `@cgohlke` and `twine upload *`.
* [ ] Download and extract tarball from `@cgohlke` and copy into `dist/`
### Mac and Linux
* [ ] Use the [Pillow Wheel Builder](https://github.com/python-pillow/pillow-wheels):
@ -101,7 +109,8 @@ Released as needed privately to individual vendors for critical security-related
cd pillow-wheels
./update-pillow-tag.sh [[release tag]]
```
* [ ] Download wheels from the [Pillow Wheel Builder release](https://github.com/python-pillow/pillow-wheels/releases).
* [ ] Download wheels from the [Pillow Wheel Builder release](https://github.com/python-pillow/pillow-wheels/releases)
and copy into `dist/`
## Publicize Release

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
import sys

View File

@ -4,7 +4,7 @@ from PIL import PyAccess
from .helper import hopper
# Not running this test by default. No DOS against Travis CI.
# Not running this test by default. No DOS against CI.
def iterate_get(size, access):

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
from PIL import Image

View File

@ -5,4 +5,5 @@ from io import BytesIO
from PIL import Image
Image.open(BytesIO(b"icns\x00\x00\x00\x10hang\x00\x00\x00\x00"))
with Image.open(BytesIO(b"icns\x00\x00\x00\x10hang\x00\x00\x00\x00")):
pass

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
import pytest
from PIL import Image

View File

@ -5,4 +5,7 @@ from io import BytesIO
from PIL import Image
Image.open(BytesIO(b"\x00\x00\x00\x0cjP\x20\x20\x0d\x0a\x87\x0a\x00\x00\x00\x00hang"))
with Image.open(
BytesIO(b"\x00\x00\x00\x0cjP\x20\x20\x0d\x0a\x87\x0a\x00\x00\x00\x00hang")
):
pass

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# Reproductions/tests for OOB read errors in FliDecode.c

View File

@ -10,3 +10,22 @@ def pytest_report_header(config):
return out.getvalue()
except Exception as e:
return f"pytest_report_header failed: {e}"
def pytest_configure(config):
config.addinivalue_line(
"markers",
"pil_noop_mark: A conditional mark where nothing special happens",
)
# We're marking some tests to ignore valgrind errors and XFAIL them.
# Ensure that the mark is defined
# even in cases where pytest-valgrind isn't installed
try:
config.addinivalue_line(
"markers",
"valgrind_known_error: Tests that have known issues with valgrind",
)
except Exception:
# valgrind is already installed
pass

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
import base64
import os

View File

@ -0,0 +1,40 @@
DejaVuSans-24-{1,2,4,8}-stripped.ttf are based on DejaVuSans.ttf converted using FontForge to add bitmap strikes and keep only the ASCII range.
DejaVu Fonts — License
Fonts are © Bitstream (see below). DejaVu changes are in public domain. Explanation of copyright is on Gnome page on Bitstream Vera fonts. Glyphs imported from Arev fonts are © Tavmjung Bah (see below)
Bitstream Vera Fonts Copyright
Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is a trademark of Bitstream, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy of the fonts accompanying this license ("Fonts") and associated documentation files (the "Font Software"), to reproduce and distribute the Font Software, including without limitation the rights to use, copy, merge, publish, distribute, and/or sell copies of the Font Software, and to permit persons to whom the Font Software is furnished to do so, subject to the following conditions:
The above copyright and trademark notices and this permission notice shall be included in all copies of one or more of the Font Software typefaces.
The Font Software may be modified, altered, or added to, and in particular the designs of glyphs or characters in the Fonts may be modified and additional glyphs or characters may be added to the Fonts, only if the fonts are renamed to names not containing either the words "Bitstream" or the word "Vera".
This License becomes null and void to the extent applicable to Fonts or Font Software that has been modified and is distributed under the "Bitstream Vera" names.
The Font Software may be sold as part of a larger software package but no copy of one or more of the Font Software typefaces may be sold by itself.
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.
Except as contained in this notice, the names of Gnome, the Gnome Foundation, and Bitstream Inc., shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Font Software without prior written authorization from the Gnome Foundation or Bitstream Inc., respectively. For further information, contact: fonts at gnome dot org.
Arev Fonts Copyright
Original text
Copyright (c) 2006 by Tavmjong Bah. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of the fonts accompanying this license ("Fonts") and associated documentation files (the "Font Software"), to reproduce and distribute the modifications to the Bitstream Vera Font Software, including without limitation the rights to use, copy, merge, publish, distribute, and/or sell copies of the Font Software, and to permit persons to whom the Font Software is furnished to do so, subject to the following conditions:
The above copyright and trademark notices and this permission notice shall be included in all copies of one or more of the Font Software typefaces.
The Font Software may be modified, altered, or added to, and in particular the designs of glyphs or characters in the Fonts may be modified and additional glyphs or characters may be added to the Fonts, only if the fonts are renamed to names not containing either the words "Tavmjong Bah" or the word "Arev".
This License becomes null and void to the extent applicable to Fonts or Font Software that has been modified and is distributed under the "Tavmjong Bah Arev" names.
The Font Software may be sold as part of a larger software package but no copy of one or more of the Font Software typefaces may be sold by itself.
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL TAVMJONG BAH BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.
Except as contained in this notice, the name of Tavmjong Bah shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Font Software without prior written authorization from Tavmjong Bah. For further information, contact: tavmjong @ free . fr.

View File

@ -11,10 +11,15 @@ BungeeColor-Regular_colr_Windows.ttf, from https://github.com/djrrb/bungee
All of the above fonts are published under the SIL Open Font License (OFL) v1.1 (http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=OFL), which allows you to copy, modify, and redistribute them if you need to.
FreeMono.ttf is licensed under GPLv3, with the GPL font exception.
OpenSansCondensed-LightItalic.tt, from https://fonts.google.com/specimen/Open+Sans, under Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
DejaVuSans-24-{1,2,4,8}-stripped.ttf are based on DejaVuSans.ttf converted using FontForge to add bitmap strikes and keep only the ASCII range.
chromacheck-sbix.woff, from https://github.com/RoelN/ChromaCheck, under The MIT License (MIT), Copyright (c) 2018 Roel Nieskens, https://pixelambacht.nl Copyright (c) 2018 Google LLC
KhmerOSBattambang-Regular.ttf is licensed under LGPL-2.1 or later.
FreeMono.ttf is licensed under GPLv3.
10x20-ISO8859-1.pcf, from https://packages.ubuntu.com/xenial/xfonts-base

Binary file not shown.

View File

@ -173,6 +173,21 @@ def skip_unless_feature_version(feature, version_required, reason=None):
return pytest.mark.skipif(version_available < version_required, reason=reason)
def mark_if_feature_version(mark, feature, version_blacklist, reason=None):
if not features.check(feature):
return pytest.mark.pil_noop_mark()
if reason is None:
reason = f"{feature} is {version_blacklist}"
version_required = parse_version(version_blacklist)
version_available = parse_version(features.version(feature))
if (
version_available.major == version_required.major
and version_available.minor == version_required.minor
):
return mark(reason=reason)
return pytest.mark.pil_noop_mark()
@pytest.mark.skipif(sys.platform.startswith("win32"), reason="Requires Unix or macOS")
class PillowLeakTestCase:
# requires unix/macOS
@ -257,8 +272,23 @@ def netpbm_available():
return bool(shutil.which("ppmquant") and shutil.which("ppmtogif"))
def imagemagick_available():
return bool(IMCONVERT and shutil.which(IMCONVERT))
def magick_command():
if sys.platform == "win32":
magickhome = os.environ.get("MAGICK_HOME", "")
if magickhome:
imagemagick = [os.path.join(magickhome, "convert.exe")]
graphicsmagick = [os.path.join(magickhome, "gm.exe"), "convert"]
else:
imagemagick = None
graphicsmagick = None
else:
imagemagick = ["convert"]
graphicsmagick = ["gm", "convert"]
if imagemagick and shutil.which(imagemagick[0]):
return imagemagick
elif graphicsmagick and shutil.which(graphicsmagick[0]):
return graphicsmagick
def on_appveyor():
@ -270,7 +300,7 @@ def on_github_actions():
def on_ci():
# GitHub Actions, Travis and AppVeyor have "CI"
# GitHub Actions and AppVeyor have "CI"
return "CI" in os.environ
@ -278,6 +308,12 @@ def is_big_endian():
return sys.byteorder == "big"
def is_ppc64le():
import platform
return platform.machine() == "ppc64le"
def is_win32():
return sys.platform.startswith("win32")
@ -290,14 +326,6 @@ def is_mingw():
return sysconfig.get_platform() == "mingw"
if sys.platform == "win32":
IMCONVERT = os.environ.get("MAGICK_HOME", "")
if IMCONVERT:
IMCONVERT = os.path.join(IMCONVERT, "convert.exe")
else:
IMCONVERT = "convert"
class cached_property:
def __init__(self, func):
self.func = func

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 582 B

BIN
Tests/images/bc5_snorm.dds Normal file

Binary file not shown.

Binary file not shown.

BIN
Tests/images/bc5_unorm.dds Normal file

Binary file not shown.

BIN
Tests/images/bc5_unorm.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

BIN
Tests/images/bc5s.dds Normal file

Binary file not shown.

BIN
Tests/images/bc5s.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 530 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 972 B

BIN
Tests/images/hopper.dds Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 B

Some files were not shown because too many files have changed in this diff Show More