From d6f19625e8cadc92e792f3567c9e82ee057653fa Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Fri, 23 Jun 2023 21:52:00 +1000 Subject: [PATCH 1/5] Removed support for 32-bit --- .appveyor.yml | 4 +- .github/workflows/test-docker.yml | 4 +- .github/workflows/test-mingw.yml | 63 +++++++++--------------------- .github/workflows/test-windows.yml | 18 +++------ Tests/32bit_segfault_check.py | 8 ---- Tests/check_large_memory.py | 5 --- Tests/check_large_memory_numpy.py | 5 --- Tests/test_core_resources.py | 5 --- Tests/test_file_webp.py | 2 - Tests/test_image_putdata.py | 5 +-- Tests/test_map.py | 3 -- docs/installation.rst | 17 +++----- setup.py | 20 ++++------ src/libImaging/ImagingUtils.h | 2 +- winbuild/build.rst | 6 +-- winbuild/build_prepare.py | 8 +--- 16 files changed, 47 insertions(+), 128 deletions(-) delete mode 100755 Tests/32bit_segfault_check.py diff --git a/.appveyor.yml b/.appveyor.yml index 36f5bd0ad68..9a2eef76781 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -10,8 +10,8 @@ environment: TEST_OPTIONS: DEPLOY: YES matrix: - - PYTHON: C:/Python311 - ARCHITECTURE: x86 + - PYTHON: C:/Python311-x64 + ARCHITECTURE: x64 APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022 - PYTHON: C:/Python38-x64 ARCHITECTURE: x64 diff --git a/.github/workflows/test-docker.yml b/.github/workflows/test-docker.yml index 3bcb8cfbca7..f22733dc463 100644 --- a/.github/workflows/test-docker.yml +++ b/.github/workflows/test-docker.yml @@ -38,8 +38,8 @@ jobs: centos-7-amd64, centos-stream-8-amd64, centos-stream-9-amd64, - debian-11-bullseye-x86, - debian-12-bookworm-x86, + debian-11-bullseye-amd64, + debian-12-bookworm-amd64, fedora-37-amd64, fedora-38-amd64, gentoo, diff --git a/.github/workflows/test-mingw.yml b/.github/workflows/test-mingw.yml index a109ec0d8b5..4269eeb62bb 100644 --- a/.github/workflows/test-mingw.yml +++ b/.github/workflows/test-mingw.yml @@ -21,27 +21,16 @@ concurrency: jobs: build: runs-on: windows-latest - strategy: - fail-fast: false - matrix: - mingw: ["MINGW32", "MINGW64"] - include: - - mingw: "MINGW32" - name: "MSYS2 MinGW 32-bit" - package: "mingw-w64-i686" - - mingw: "MINGW64" - name: "MSYS2 MinGW 64-bit" - package: "mingw-w64-x86_64" defaults: run: shell: bash.exe --login -eo pipefail "{0}" env: - MSYSTEM: ${{ matrix.mingw }} + MSYSTEM: MINGW64 CHERE_INVOKING: 1 timeout-minutes: 30 - name: ${{ matrix.name }} + name: "MSYS2 MinGW" steps: - name: Checkout Pillow @@ -54,26 +43,22 @@ jobs: - name: Install dependencies run: | pacman -S --noconfirm \ - ${{ matrix.package }}-freetype \ - ${{ matrix.package }}-gcc \ - ${{ matrix.package }}-ghostscript \ - ${{ matrix.package }}-lcms2 \ - ${{ matrix.package }}-libimagequant \ - ${{ matrix.package }}-libjpeg-turbo \ - ${{ matrix.package }}-libraqm \ - ${{ matrix.package }}-libtiff \ - ${{ matrix.package }}-libwebp \ - ${{ matrix.package }}-openjpeg2 \ - ${{ matrix.package }}-python3-cffi \ - ${{ matrix.package }}-python3-numpy \ - ${{ matrix.package }}-python3-olefile \ - ${{ matrix.package }}-python3-pip \ - ${{ matrix.package }}-python3-setuptools - - if [ ${{ matrix.package }} == "mingw-w64-x86_64" ]; then - pacman -S --noconfirm \ - ${{ matrix.package }}-python-pyqt6 - fi + mingw-w64-x86_64-freetype \ + mingw-w64-x86_64-gcc \ + mingw-w64-x86_64-ghostscript \ + mingw-w64-x86_64-lcms2 \ + mingw-w64-x86_64-libimagequant \ + mingw-w64-x86_64-libjpeg-turbo \ + mingw-w64-x86_64-libraqm \ + mingw-w64-x86_64-libtiff \ + mingw-w64-x86_64-libwebp \ + mingw-w64-x86_64-openjpeg2 \ + mingw-w64-x86_64-python3-cffi \ + mingw-w64-x86_64-python3-numpy \ + mingw-w64-x86_64-python3-olefile \ + mingw-w64-x86_64-python3-pip \ + mingw-w64-x86_64-python3-setuptools \ + mingw-w64-x86_64-python-pyqt6 python3 -m pip install pyroma pytest pytest-cov pytest-timeout @@ -93,14 +78,4 @@ jobs: with: file: ./coverage.xml flags: GHA_Windows - name: ${{ matrix.name }} - - success: - permissions: - contents: none - needs: build - runs-on: ubuntu-latest - name: MinGW Test Successful - steps: - - name: Success - run: echo MinGW Test Successful + name: "MSYS2 MinGW" diff --git a/.github/workflows/test-windows.yml b/.github/workflows/test-windows.yml index cab47b01f3d..b5fd4395f4c 100644 --- a/.github/workflows/test-windows.yml +++ b/.github/workflows/test-windows.yml @@ -24,18 +24,11 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12-dev"] - architecture: ["x86", "x64"] - include: - # PyPy 7.3.4+ only ships 64-bit binaries for Windows - - python-version: "pypy3.9" - architecture: "x64" - - python-version: "pypy3.10" - architecture: "x64" + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12-dev", "pypy3.9", "pypy3.10"] timeout-minutes: 30 - name: Python ${{ matrix.python-version }} ${{ matrix.architecture }} + name: Python ${{ matrix.python-version }} steps: - name: Checkout Pillow @@ -58,7 +51,6 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - architecture: ${{ matrix.architecture }} cache: pip cache-dependency-path: ".github/workflows/test-windows.yml" @@ -206,14 +198,14 @@ jobs: with: file: ./coverage.xml flags: GHA_Windows - name: ${{ runner.os }} Python ${{ matrix.python-version }} ${{ matrix.architecture }} + name: ${{ runner.os }} Python ${{ matrix.python-version }} - name: Build wheel id: wheel if: "github.event_name != 'pull_request'" run: | - mkdir fribidi\${{ matrix.architecture }} - copy winbuild\build\bin\fribidi* fribidi\${{ matrix.architecture }} + mkdir fribidi + copy winbuild\build\bin\fribidi* fribidi setlocal EnableDelayedExpansion for %%f in (winbuild\build\license\*) do ( set x=%%~nf diff --git a/Tests/32bit_segfault_check.py b/Tests/32bit_segfault_check.py deleted file mode 100755 index 2ff7f908f6d..00000000000 --- a/Tests/32bit_segfault_check.py +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env python3 - -import sys - -from PIL import Image - -if sys.maxsize < 2**32: - im = Image.new("L", (999999, 999999), 0) diff --git a/Tests/check_large_memory.py b/Tests/check_large_memory.py index d98f4a694ef..219788d7bd9 100644 --- a/Tests/check_large_memory.py +++ b/Tests/check_large_memory.py @@ -1,5 +1,3 @@ -import sys - import pytest from PIL import Image @@ -23,9 +21,6 @@ XDIM = 48000 -pytestmark = pytest.mark.skipif(sys.maxsize <= 2**32, reason="requires 64-bit system") - - def _write_png(tmp_path, xdim, ydim): f = str(tmp_path / "temp.png") im = Image.new("L", (xdim, ydim), 0) diff --git a/Tests/check_large_memory_numpy.py b/Tests/check_large_memory_numpy.py index 24cb1f722bf..c54894721d0 100644 --- a/Tests/check_large_memory_numpy.py +++ b/Tests/check_large_memory_numpy.py @@ -1,5 +1,3 @@ -import sys - import pytest from PIL import Image @@ -19,9 +17,6 @@ XDIM = 48000 -pytestmark = pytest.mark.skipif(sys.maxsize <= 2**32, reason="requires 64-bit system") - - def _write_png(tmp_path, xdim, ydim): dtype = np.uint8 a = np.zeros((xdim, ydim), dtype=dtype) diff --git a/Tests/test_core_resources.py b/Tests/test_core_resources.py index 9021a9fb36d..f2105d6ca6c 100644 --- a/Tests/test_core_resources.py +++ b/Tests/test_core_resources.py @@ -1,5 +1,3 @@ -import sys - import pytest from PIL import Image @@ -110,9 +108,6 @@ def test_set_blocks_max(self): with pytest.raises(ValueError): Image.core.set_blocks_max(-1) - if sys.maxsize < 2**32: - with pytest.raises(ValueError): - Image.core.set_blocks_max(2**29) @pytest.mark.skipif(is_pypy(), reason="Images not collected") def test_set_blocks_max_stats(self): diff --git a/Tests/test_file_webp.py b/Tests/test_file_webp.py index a7b6c735a69..01b11447ac4 100644 --- a/Tests/test_file_webp.py +++ b/Tests/test_file_webp.py @@ -1,6 +1,5 @@ import io import re -import sys import warnings import pytest @@ -145,7 +144,6 @@ def test_write_unsupported_mode_P(self, tmp_path): self._roundtrip(tmp_path, "P", 50.0) - @pytest.mark.skipif(sys.maxsize <= 2**32, reason="Requires 64-bit system") def test_write_encoding_error_message(self, tmp_path): temp_file = str(tmp_path / "temp.webp") im = Image.new("RGB", (15000, 15000)) diff --git a/Tests/test_image_putdata.py b/Tests/test_image_putdata.py index 0e6293349bc..db5307d2ccb 100644 --- a/Tests/test_image_putdata.py +++ b/Tests/test_image_putdata.py @@ -38,10 +38,7 @@ def put(value): assert put(0xFFFFFFFF) == (255, 255, 255, 255) assert put(-1) == (255, 255, 255, 255) assert put(-1) == (255, 255, 255, 255) - if sys.maxsize > 2**32: - assert put(sys.maxsize) == (255, 255, 255, 255) - else: - assert put(sys.maxsize) == (255, 255, 255, 127) + assert put(sys.maxsize) == (255, 255, 255, 255) def test_pypy_performance(): diff --git a/Tests/test_map.py b/Tests/test_map.py index d816bddaf3d..42b6f7cddab 100644 --- a/Tests/test_map.py +++ b/Tests/test_map.py @@ -1,5 +1,3 @@ -import sys - import pytest from PIL import Image @@ -36,7 +34,6 @@ def test_tobytes(): Image.MAX_IMAGE_PIXELS = max_pixels -@pytest.mark.skipif(sys.maxsize <= 2**32, reason="Requires 64-bit system") def test_ysize(): numpy = pytest.importorskip("numpy", reason="NumPy not installed") diff --git a/docs/installation.rst b/docs/installation.rst index dc1cd8653d6..79e14d47815 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -285,11 +285,8 @@ Many of Pillow's features require external libraries: .. tab:: Windows using MSYS2/MinGW - To build Pillow using MSYS2, make sure you run the **MSYS2 MinGW 32-bit** or - **MSYS2 MinGW 64-bit** console, *not* **MSYS2** directly. - - The following instructions target the 64-bit build, for 32-bit - replace all occurrences of ``mingw-w64-x86_64-`` with ``mingw-w64-i686-``. + To build Pillow using MSYS2, make sure you run the **MSYS2 MinGW 64-bit** console, + *not* **MSYS2** directly. Make sure you have Python and GCC installed:: @@ -339,8 +336,6 @@ Many of Pillow's features require external libraries: pkg install -y python ndk-sysroot clang make \ libjpeg-turbo - This has been tested within the Termux app on ChromeOS, on x86. - Installing ^^^^^^^^^^ @@ -451,9 +446,9 @@ These platforms are built and tested for every change. +----------------------------------+----------------------------+---------------------+ | CentOS Stream 9 | 3.9 | x86-64 | +----------------------------------+----------------------------+---------------------+ -| Debian 11 Bullseye | 3.9 | x86 | +| Debian 11 Bullseye | 3.9 | x86-64 | +----------------------------------+----------------------------+---------------------+ -| Debian 12 Bookworm | 3.11 | x86 | +| Debian 12 Bookworm | 3.11 | x86-64 | +----------------------------------+----------------------------+---------------------+ | Fedora 37 | 3.11 | x86-64 | +----------------------------------+----------------------------+---------------------+ @@ -474,10 +469,10 @@ These platforms are built and tested for every change. +----------------------------------+----------------------------+---------------------+ | Windows Server 2016 | 3.8 | x86-64 | +----------------------------------+----------------------------+---------------------+ -| Windows Server 2022 | 3.8, 3.9, 3.10, 3.11, | x86, x86-64 | +| Windows Server 2022 | 3.8, 3.9, 3.10, 3.11, | x86-64 | | | 3.12, PyPy3 | | | +----------------------------+---------------------+ -| | 3.9 (MinGW) | x86, x86-64 | +| | 3.9 (MinGW) | x86-64 | | +----------------------------+---------------------+ | | 3.8, 3.9 (Cygwin) | x86-64 | +----------------------------------+----------------------------+---------------------+ diff --git a/setup.py b/setup.py index 7c1ad6dc5b2..b647944d3f7 100755 --- a/setup.py +++ b/setup.py @@ -153,16 +153,13 @@ def _find_library_dirs_ldconfig(): ldconfig = "ldconfig" if shutil.which("ldconfig") else "/sbin/ldconfig" if sys.platform.startswith("linux") or sys.platform.startswith("gnu"): - if struct.calcsize("l") == 4: - machine = os.uname()[4] + "-32" - else: - machine = os.uname()[4] + "-64" + machine = os.uname()[4] mach_map = { - "x86_64-64": "libc6,x86-64", - "ppc64-64": "libc6,64bit", - "sparc64-64": "libc6,64bit", - "s390x-64": "libc6,64bit", - "ia64-64": "libc6,IA-64", + "x86_64": "libc6,x86-64", + "ppc64": "libc6,64bit", + "sparc64": "libc6,64bit", + "s390x": "libc6,64bit", + "ia64": "libc6,IA-64", } abi_type = mach_map.get(machine, "libc6") @@ -584,10 +581,7 @@ def build_extensions(self): # user libs are at $PREFIX/lib _add_directory( library_dirs, - os.path.join( - os.environ["ANDROID_ROOT"], - "lib" if struct.calcsize("l") == 4 else "lib64", - ), + os.path.join(os.environ["ANDROID_ROOT"], "lib64"), ) elif sys.platform.startswith("netbsd"): diff --git a/src/libImaging/ImagingUtils.h b/src/libImaging/ImagingUtils.h index 0c0c1eda917..f2acabeac1a 100644 --- a/src/libImaging/ImagingUtils.h +++ b/src/libImaging/ImagingUtils.h @@ -30,7 +30,7 @@ /* This is to work around a bug in GCC prior 4.9 in 64 bit mode. GCC generates code with partial dependency which is 3 times slower. See: https://stackoverflow.com/a/26588074/253146 */ -#if defined(__x86_64__) && defined(__SSE__) && !defined(__NO_INLINE__) && \ +#if defined(__SSE__) && !defined(__NO_INLINE__) && \ !defined(__clang__) && defined(GCC_VERSION) && (GCC_VERSION < 40900) static float __attribute__((always_inline)) inline _i2f(int v) { float x; diff --git a/winbuild/build.rst b/winbuild/build.rst index 99dfad3015f..97df950b348 100644 --- a/winbuild/build.rst +++ b/winbuild/build.rst @@ -27,7 +27,7 @@ Download and install: * `Ninja `_ (optional, use ``--nmake`` if not available; bundled in Visual Studio CMake component) -* x86/x64: `Netwide Assembler (NASM) `_ +* x64: `Netwide Assembler (NASM) `_ Any version of Visual Studio 2017 or newer should be supported, including Visual Studio 2017 Community, or Build Tools for Visual Studio 2019. @@ -42,7 +42,7 @@ Run ``build_prepare.py`` to configure the build:: usage: winbuild\build_prepare.py [-h] [-v] [-d PILLOW_BUILD] [--depends PILLOW_DEPS] - [--architecture {x86,x64,ARM64}] + [--architecture {x64,ARM64}] [--python PYTHON] [--executable EXECUTABLE] [--nmake] [--no-imagequant] [--no-fribidi] @@ -56,7 +56,7 @@ Run ``build_prepare.py`` to configure the build:: --depends PILLOW_DEPS directory used to store cached dependencies (default: 'winbuild\depends') - --architecture {x86,x64,ARM64} + --architecture {x64,ARM64} build architecture (default: same as host Python) --python PYTHON Python install directory (default: use host Python) --executable EXECUTABLE diff --git a/winbuild/build_prepare.py b/winbuild/build_prepare.py index 89b2daad005..d8212ee5150 100644 --- a/winbuild/build_prepare.py +++ b/winbuild/build_prepare.py @@ -3,7 +3,6 @@ import platform import re import shutil -import struct import subprocess import sys @@ -98,7 +97,6 @@ def cmd_msbuild( SF_PROJECTS = "https://sourceforge.net/projects" architectures = { - "x86": {"vcvars_arch": "x86", "msbuild_arch": "Win32"}, "x64": {"vcvars_arch": "x86_amd64", "msbuild_arch": "x64"}, "ARM64": {"vcvars_arch": "x86_arm64", "msbuild_arch": "ARM64"}, } @@ -611,11 +609,7 @@ def build_pillow(): choices=architectures, default=os.environ.get( "ARCHITECTURE", - ( - "ARM64" - if platform.machine() == "ARM64" - else ("x86" if struct.calcsize("P") == 4 else "x64") - ), + "ARM64" if platform.machine() == "ARM64" else "x64", ), help="build architecture (default: same as host Python)", ) From 5498cb800c8a432f709cffde219d38ef521fd4e9 Mon Sep 17 00:00:00 2001 From: Andrew Murray <3112309+radarhere@users.noreply.github.com> Date: Sat, 24 Jun 2023 17:46:42 +1000 Subject: [PATCH 2/5] Order slower jobs first Co-authored-by: Hugo van Kemenade --- .github/workflows/test-windows.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-windows.yml b/.github/workflows/test-windows.yml index b5fd4395f4c..3a24fd36a3e 100644 --- a/.github/workflows/test-windows.yml +++ b/.github/workflows/test-windows.yml @@ -24,7 +24,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12-dev", "pypy3.9", "pypy3.10"] + python-version: ["pypy3.10", "pypy3.9", "3.8", "3.9", "3.10", "3.11", "3.12-dev"] timeout-minutes: 30 From 9c5175d04871647dfae3a3286b9b60d250a0566f Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Sat, 24 Jun 2023 17:52:28 +1000 Subject: [PATCH 3/5] Added release notes --- docs/releasenotes/10.0.0.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/releasenotes/10.0.0.rst b/docs/releasenotes/10.0.0.rst index 3ffafafdc15..ec3a6927efb 100644 --- a/docs/releasenotes/10.0.0.rst +++ b/docs/releasenotes/10.0.0.rst @@ -4,6 +4,11 @@ Backwards Incompatible Changes ============================== +32-bit support +^^^^^^^^^^^^^^ + +32-bit architecture is no longer supported. + Categories ^^^^^^^^^^ From b6751b24de19770da2b18ebd112ef069c7e741dc Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Sat, 24 Jun 2023 19:17:30 +1000 Subject: [PATCH 4/5] Updated mergify --- .github/mergify.yml | 2 +- .github/workflows/test-mingw.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/mergify.yml b/.github/mergify.yml index 8dfa07f4ec5..3c20661376f 100644 --- a/.github/mergify.yml +++ b/.github/mergify.yml @@ -7,7 +7,7 @@ pull_request_rules: - status-success=Test Successful - status-success=Docker Test Successful - status-success=Windows Test Successful - - status-success=MinGW Test Successful + - status-success=MinGW - status-success=Cygwin Test Successful - status-success=continuous-integration/appveyor/pr actions: diff --git a/.github/workflows/test-mingw.yml b/.github/workflows/test-mingw.yml index 4269eeb62bb..59fd5ed9dc7 100644 --- a/.github/workflows/test-mingw.yml +++ b/.github/workflows/test-mingw.yml @@ -30,7 +30,7 @@ jobs: CHERE_INVOKING: 1 timeout-minutes: 30 - name: "MSYS2 MinGW" + name: "MinGW" steps: - name: Checkout Pillow From abf05414de5eecf5b3115a86e72247adc6ceaebd Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Sat, 24 Jun 2023 21:52:13 +1000 Subject: [PATCH 5/5] Mention that 32-bit wheels are no longer provided --- docs/releasenotes/10.0.0.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/releasenotes/10.0.0.rst b/docs/releasenotes/10.0.0.rst index ec3a6927efb..d33b75e4da3 100644 --- a/docs/releasenotes/10.0.0.rst +++ b/docs/releasenotes/10.0.0.rst @@ -7,7 +7,7 @@ Backwards Incompatible Changes 32-bit support ^^^^^^^^^^^^^^ -32-bit architecture is no longer supported. +32-bit architecture is no longer supported and 32-bit wheels are no longer provided. Categories ^^^^^^^^^^