Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

cp316 drops required macro for Pillow to compile

Cerrado
#10,323 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@lazerg ya está trabajando en esto.

Desde el 26/10/2026.

  • #10324 de @lazerg — abierto

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
48/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
c, python
Área
build-system

Línea de trabajo

Start with src/libImaging/ImPlatform.h and inspect the HAVE_PROTOTYPES check alongside Pillow’s supported Python versions and C requirements. Reproduce the build failure using the reported CPython main branch and GCC or Clang, then check compatibility across the support window. Done when Pillow builds on CPython main without breaking its supported older Python versions.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

What did you do?

Tried to compile from source with cpython main branch

What did you expect to happen?

It to compile.

What actually happened?

Failed to compile.

What are your OS, Python and Pillow versions?
  • OS: arch, gcc (gcc (GCC) 16.2.1 20260810) or clang (clang version 23.1.4)
  • Python: main branch (v3.16.0a1-393-ga9049ee4fb6)
  • Pillow: main branch (1.7.6-21484-g5e898683d)
      In file included from src/libImaging/Imaging.h:13,
                       from src/libImaging/Effects.c:18:
      src/libImaging/ImPlatform.h:15:2: error: #error Sorry, this library requires support for ANSI prototypes.
         15 | #error Sorry, this library requires support for ANSI prototypes.
            |  ^~~~~
      In file included from src/libImaging/Imaging.h:13,
                       from src/libImaging/Draw.c:35:
      src/libImaging/ImPlatform.h:15:2: error: #error Sorry, this library requires support for ANSI prototypes.
         15 | #error Sorry, this library requires support for ANSI prototypes.
            |  ^~~~~
      error: Command ['gcc', '-DCYTHON_FAST_THREAD_STATE=0', '-fPIC', '-DHAVE_LIBTIFF', '-DHAVE_LIBJPEG', '-DHAVE_OPENJPEG', '-DHAVE_LIBZ', '-DHAVE_LIBIMAGEQUANT', '-DHAVE_XCB', '-DPILLOW_VERSION="13.1.0.dev0"', '-I/usr/include/freetype2', '-I/usr/include/openjpeg-2.5', '-I/usr/include', '-I/usr/include/webp', '-I/usr/include/libpng16', '-I/usr/include/harfbuzz', '-I/usr/include/glib-2.0', '-I/usr/lib/glib-2.0/include', '-I/usr/include/sysprof-6', '-I/usr/include/fribidi', '-I/home/tcaswell/.virtualenvs/cp316/include', '-I/usr/local/include', '-I/home/tcaswell/.virtualenvs/cp316/include', '-I/home/tcaswell/.pybuild/cp316/include/python3.16', '-c', 'src/libImaging/ColorLUT.c', '-o', 'build/temp.linux-x86_64-cpython-316/src/libImaging/ColorLUT.o'] returned non-zero exit status 1.
      [end of output]
     error: Command ['clang', '-DCYTHON_FAST_THREAD_STATE=0', '-fPIC', '-DHAVE_LIBTIFF', '-DHAVE_LIBJPEG', '-DHAVE_OPENJPEG', '-DHAVE_LIBZ', '-DHAVE_LIBIMAGEQUANT', '-DHAVE_XCB', '-DPILLOW_VERSION="13.1.0.dev0"', '-I/usr/include/freetype2', '-I/usr/include/openjpeg-2.5', '-I/usr/include', '-I/usr/include/webp', '-I/usr/include/libpng16', '-I/usr/include/harfbuzz', '-I/usr/include/glib-2.0', '-I/usr/lib/glib-2.0/include', '-I/usr/include/sysprof-6', '-I/usr/include/fribidi', '-I/home/tcaswell/.virtualenvs/cp316-clang/include', '-I/usr/local/include', '-I/home/tcaswell/.virtualenvs/cp316-clang/include', '-I/home/tcaswell/.pybuild/cp316-clang/include/python3.16', '-c', 'src/libImaging/Arrow.c', '-o', 'build/temp.linux-x86_64-cpython-316/src/libImaging/Arrow.o'] returned non-zero exit status 1.
      src/_imaging.c:1324:84: warning: implicit conversion from enumeration type 'const ModeID' to different enumeration type 'RawModeID' [-Wimplicit-enum-enum-cast]
       1324 |     const RawModeID rawmode = rawmode_name != NULL ? findRawModeID(rawmode_name) : mode;
            |                     ~~~~~~~                                                        ^~~~
      1 error generated.
      In file included from src/libImaging/ColorLUT.c:1:
      In file included from src/libImaging/Imaging.h:13:
      src/libImaging/ImPlatform.h:15:2: error: Sorry, this library requires support for ANSI prototypes.
         15 | #error Sorry, this library requires support for ANSI prototypes.
            |  ^
      1 error generated.
      1 error generated.
      1 warning and 1 error generated.
      In file included from src/libImaging/Draw.c:35:
      In file included from src/libImaging/Imaging.h:13:
      src/libImaging/ImPlatform.h:15:2: error: Sorry, this library requires support for ANSI prototypes.
         15 | #error Sorry, this library requires support for ANSI prototypes.
            |  ^
      1 error generated.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.

The source of the problem is that upstream removed the HAVE_PROTOTYPES macro in https://github.com/python/cpython/pull/159513 .

This minimal fix is:

diff --git a/src/libImaging/ImPlatform.h b/src/libImaging/ImPlatform.h
index a800d8278..29c4425e4 100644
--- a/src/libImaging/ImPlatform.h
+++ b/src/libImaging/ImPlatform.h
@@ -11,9 +11,6 @@
 #include <Python.h>
 
 /* Check that we have an ANSI compliant compiler */
-#ifndef HAVE_PROTOTYPES
-#error Sorry, this library requires support for ANSI prototypes.
-#endif
 #ifndef STDC_HEADERS
 #error Sorry, this library requires ANSI header files.
 #endif

but I am not sure the exact intersection of when Python's minimum C is high enough that this is unneeded and and the support window of old Python for Pillow intersect to make this safe to just drop or if it requires some version gating on CPython version.

I also leave to @hugovk if there is a case to be made to revert this upstream or just deal with it here.

Lenguaje dominante
Python
Estrellas
13.9k
Forks
2.6k
Merge medio
1 d 6 h
PR fusionados (30 d)
172

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de python-pillow/Pillow

Todos los issues de python-pillow/Pillow

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.