Skip to content

Add support for building Python 3.11.x #387

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

Merged
merged 8 commits into from
May 22, 2025

Conversation

jcfr
Copy link
Contributor

@jcfr jcfr commented May 8, 2025

  • Add checksums for Python 3.11.0 to 3.11.12

  • Set default python version to 3.11.12

  • Switch from c99 to c11

  • Add convenience target deepfreeze_modules for regenerating download the deepfreeze sources

  • Check that TCL is at least 8.5.12

dbm extension:

  • Add support for GDBM_COMPAT introducing NDBM_USE variable set to either
    NDBM or GDBM_COMPAT. See python/cpython@0a9f69539be ("bpo-45747: Detect gdbm/dbm dependencies in configure (GH-29467)", 2021-11-10)

Updated pyconfig.h.in

  • Add the following for which there was already a configure check.
    • Headers:
      • HAVE_BZLIB_H
      • HAVE_DB_H
      • HAVE_GDBM_DASH_NDBM_H
      • HAVE_GDBM_H
      • HAVE_GDBM_NDBM_H
      • HAVE_LZMA_H
      • HAVE_NDBM_H
      • HAVE_NETDB_H
      • HAVE_NETINET_IN_H
      • HAVE_RPC_RPC_H
      • HAVE_ZLIB_H
    • Library:
      • HAVE_LIBDB
      • HAVE_LIBGDBM_COMPAT
      • HAVE_LIBNDBM
      • HAVE_LIBSQLITE3

Updated pyconfig.h.in and configure checks:

  • Add options:

    • WITH_FREELISTS set to 1 if Python 3.11 and 0 otherwise
  • Add header checks:

    • HAVE_LINUX_LIMITS_H
    • HAVE_LINUX_SOUNDCARD_H
    • HAVE_NETCAN_CAN_H
    • HAVE_SETJMP_H
    • HAVE_SYS_SOUNDCARD_H
    • HAVE_SYSLOG_H
    • HAVE_UTMP_H
  • Add symbol checks:

    • HAVE_ACCEPT
    • HAVE_BIND
    • HAVE_CHMOD
    • HAVE_CLOCK_NANOSLEEP
    • HAVE_CONNECT
    • HAVE_DUP
    • HAVE_FORK1
    • HAVE_GETEGID
    • HAVE_GETEUID
    • HAVE_GETGID
    • HAVE_GETGRGID
    • HAVE_GETHOSTBYADDR
    • HAVE_GETHOSTNAME
    • HAVE_GETPPID
    • HAVE_GETPROTOBYNAME
    • HAVE_GETPWUID
    • HAVE_GETRUSAGE
    • HAVE_GETSERVBYNAME
    • HAVE_GETSERVBYPORT
    • HAVE_GETSOCKNAME
    • HAVE_GETUID
    • HAVE_INET_NTOA
    • HAVE_LISTEN
    • HAVE_LOGIN_TTY
    • HAVE_NANOSLEEP
    • HAVE_OPENDIR
    • HAVE_PIPE
    • HAVE_RECVFROM
    • HAVE_RL_COMPDISP_FUNC_T
    • HAVE_SENDTO
    • HAVE_SETSOCKOPT
    • HAVE_SHUTDOWN
    • HAVE_SOCKET
    • HAVE_SYSTEM
    • HAVE_TTYNAME
    • HAVE_UMASK
    • HAVE_WAIT

Testing:

  • Command line option "-l/--findleaks" of regrtest is deprecated since Python 3.7 and removed in Python 3.11. It is superseded by --fail-env-changed.

Update pyconfig.h.in adding the following WASI related defines that will require additional work: HAVE_PTHREAD_STUBS, _WASI_EMULATED_GETPID, _WASI_EMULATED_PROCESS_CLOCKS, _WASI_EMULATED_SIGNAL:


Working toward addressing:

@jcfr jcfr linked an issue May 8, 2025 that may be closed by this pull request
@jcfr jcfr marked this pull request as draft May 8, 2025 20:01
@jcfr jcfr force-pushed the add-python-3.11-support branch 12 times, most recently from c48b9b5 to 3b92eb2 Compare May 15, 2025 17:22
@jcfr jcfr force-pushed the add-python-3.11-support branch from 3b92eb2 to ab98ee4 Compare May 16, 2025 19:36
jcfr and others added 8 commits May 16, 2025 18:09
* Add checksums for Python 3.11.0 to 3.11.12

* Set default python version to 3.11.12

* Switch from c99 to c11

* Add convenience target `deepfreeze_modules` for regenerating download
  the deepfreeze sources

* Check that TK is at least 8.5.12

* Associate `PY3_DLLNAME` with `Python/dynload_win.c`. See python/cpython@99fcf150521 ("bpo-45582: Port getpath[p].c to Python (GH-29041)", 2021-12-03)

dbm extension:

* Add support for `GDBM_COMPAT` introducing `NDBM_USE` variable set to either
  `NDBM` or `GDBM_COMPAT`.
  See python/cpython@0a9f69539be ("bpo-45747: Detect gdbm/dbm dependencies in configure (GH-29467)", 2021-11-10)

Updated pyconfig.h.in

* Add the following for which there was already a configure check.
  - Headers:
    - `HAVE_BZLIB_H`
    - `HAVE_DB_H`
    - `HAVE_GDBM_DASH_NDBM_H`
    - `HAVE_GDBM_H``
    - `HAVE_GDBM_NDBM_H`
    - `HAVE_LZMA_H`
    - `HAVE_NDBM_H`
    - `HAVE_NETDB_H`
    - `HAVE_NETINET_IN_H`
    - `HAVE_RPC_RPC_H`
    - `HAVE_ZLIB_H`
  - Library:
    - `HAVE_LIBDB`
    - `HAVE_LIBGDBM_COMPAT`
    - `HAVE_LIBNDBM`
    - `HAVE_LIBSQLITE3`

Updated pyconfig.h.in and configure checks:

* Add options:
  - `WITH_FREELISTS` set to 1 if Python 3.11 and 0 otherwise

* Add header checks:
  - `HAVE_LINUX_LIMITS_H`
  - `HAVE_LINUX_SOUNDCARD_H`
  - `HAVE_NETCAN_CAN_H`
  - `HAVE_SETJMP_H`
  - `HAVE_SYS_SOUNDCARD_H`
  - `HAVE_SYSLOG_H`
  - `HAVE_UTMP_H`

* Add symbol checks:
  - `HAVE_ACCEPT`
  - `HAVE_BIND`
  - `HAVE_CHMOD`
  - `HAVE_CLOCK_NANOSLEEP`
  - `HAVE_CONNECT`
  - `HAVE_DUP`
  - `HAVE_FORK1`
  - `HAVE_GETEGID`
  - `HAVE_GETEUID`
  - `HAVE_GETGID`
  - `HAVE_GETGRGID`
  - `HAVE_GETHOSTBYADDR`
  - `HAVE_GETHOSTNAME`
  - `HAVE_GETPPID`
  - `HAVE_GETPROTOBYNAME`
  - `HAVE_GETPWUID`
  - `HAVE_GETRUSAGE`
  - `HAVE_GETSERVBYNAME`
  - `HAVE_GETSERVBYPORT`
  - `HAVE_GETSOCKNAME`
  - `HAVE_GETUID`
  - `HAVE_INET_NTOA`
  - `HAVE_LISTEN`
  - `HAVE_LOGIN_TTY`
  - `HAVE_NANOSLEEP`
  - `HAVE_OPENDIR`
  - `HAVE_PIPE`
  - `HAVE_RECVFROM`
  - `HAVE_RL_COMPDISP_FUNC_T`
  - `HAVE_SENDTO`
  - `HAVE_SETSOCKOPT`
  - `HAVE_SHUTDOWN`
  - `HAVE_SOCKET`
  - `HAVE_SYSTEM`
  - `HAVE_TTYNAME`
  - `HAVE_UMASK`
  - `HAVE_WAIT`

Testing:

* Command line option "-l/--findleaks" of regrtest is deprecated since
  Python 3.7 and removed in Python 3.11. It is superseded by `--fail-env-changed`.

Co-authored-by: Brett Jia <dev.bjia56@gmail.com>
… in Python 3.11

Actual support for WASI still need to be implemented by adding CMake
options equivalent to `--enable-wasm-dynamic-linking`, `--enable-wasm-pthreads`
and `--with-emscripten-target`.
…uced in Python 3.11

HAVE_PTHREAD_STUBS is expected to be defined if the system is WASI.

See python/cpython@e62a0dfab2b ("[3.11] gh-95174: Add pthread stubs for WASI (GH-95234) (#95503)", 2022-08-01)
See python/cpython@cbf54b1e7ea ("configure.in: Avoid autoconf warning: Assume C89 semantics that RETSIGTYPE is always void (issue #8510). pyconfig.h: Regenerate", 2010-05-08)
@jcfr jcfr force-pushed the add-python-3.11-support branch from 0f0af8d to f6c6040 Compare May 16, 2025 22:10
@jcfr jcfr marked this pull request as ready for review May 16, 2025 22:11
Copy link
Contributor

@jamesobutler jamesobutler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the CI testing is all green here. @jcfr You ready to integrate this work?

@jcfr jcfr merged commit 5a6d5ec into python-cmake-buildsystem:master May 22, 2025
24 checks passed
@jcfr jcfr deleted the add-python-3.11-support branch May 22, 2025 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Add support for Python 3.11
2 participants