Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for Python 3.13: explicitly include unistd.h #7535

Merged
merged 3 commits into from
Nov 11, 2023

Conversation

hugovk
Copy link
Member

@hugovk hugovk commented Nov 8, 2023

Changes proposed in this pull request:

  • Test Python 3.13 pre-release
  • Explicitly include unistd.h to use lseek

Changed in Python 3.13:

  • Python.h no longer includes the <unistd.h> standard header file. If
    needed, it should now be included explicitly. For example, it provides the
    functions: read(), write(), close(), isatty(), lseek(),
    getpid(), getcwd(), sysconf(), getpagesize(), alarm() and
    pause().
    As a consequence, _POSIX_SEMAPHORES and _POSIX_THREADS macros are no
    longer defined by Python.h. The HAVE_UNISTD_H and HAVE_PTHREAD_H
    macros defined by Python.h can be used to decide if <unistd.h> and
    <pthread.h> header files can be included.

So we need to #include <unistd.h> for src/libImaging/TiffDecode.c which uses lseek.


Also add Python 3.13 to the CI for Ubuntu, macOS and Windows. We need to skip cffi, it's not ready for 3.13.

3.13 is in alpha, so we can expect things still to change. I'm fine leaving it out of the CI until later or beta, but it could be useful to get early feedback. If any sudden failures turn up, we can always comment it out until we get it sorted (in Pillow or upstream in CPython, as necessary).

@Yay295
Copy link
Contributor

Yay295 commented Nov 8, 2023

Isn't unistd.h Unix only? How is TiffDecode.c building on Windows?

@nulano
Copy link
Contributor

nulano commented Nov 8, 2023

On Windows, lseek is an alias for _lseek, both of which are declared in io.h which is included from Python.h via pyconfig.h.

@hugovk hugovk merged commit 556dd1e into python-pillow:main Nov 11, 2023
57 checks passed
@hugovk hugovk deleted the add-3.13 branch November 11, 2023 22:34
@hugovk hugovk added the Build label Nov 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants