diff --git a/.circleci/config.yml b/.circleci/config.yml index 72e05f6ad..d7fb8269a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -86,6 +86,17 @@ jobs: workflows: build-and-test: jobs: + # 3.10.17 + - build-test-python: + name: python-3.10.17-x64 + python_version: 3.10.17 + python_arch: x64 + + - build-test-python: + name: python-3.10.17-x86 + python_version: 3.10.17 + python_arch: x86 + # 3.9.22 - build-test-python: name: python-3.9.22-x64 @@ -133,6 +144,13 @@ workflows: build-and-test-win: jobs: + # 3.10.17 + - build-test-python-win: + name: python-3.10.17-win-x64 + python_version: 3.10.17 + python_arch: x64 + generator: "Visual Studio 16 2019" + # 3.9.22 - build-test-python-win: name: python-3.9.22-win-x64 diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 1de962242..cf8f519ff 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -13,7 +13,7 @@ jobs: fail-fast: false matrix: runs-on: [macos-latest] - python-version: [3.7.17, 3.8.20, 3.9.22] + python-version: [3.7.17, 3.8.20, 3.9.22, 3.10.17] include: - runs-on: macos-latest c-compiler: "clang" diff --git a/CMakeLists.txt b/CMakeLists.txt index 35a44d226..4ad5e4422 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.20.6) -set(PYTHON_VERSION "3.9.22" CACHE STRING "The version of Python to build.") +set(PYTHON_VERSION "3.10.17" CACHE STRING "The version of Python to build.") string(REPLACE "." ";" VERSION_LIST ${PYTHON_VERSION}) list(GET VERSION_LIST 0 PY_VERSION_MAJOR) @@ -66,6 +66,24 @@ option(BUILD_EXTENSIONS_AS_BUILTIN "Default all modules as builtin to libpython" option(USE_LIB64 "Search for dependencies and install to prefix/lib64 instead of prefix/lib" OFF) if(WIN32) option(INSTALL_WINDOWS_TRADITIONAL "Install the executable and extensions in the traditional location" OFF) +else() + set(INSTALL_WINDOWS_TRADITIONAL OFF) +endif() + +if(WIN32 AND PY_VERSION VERSION_GREATER_EQUAL "3.10") + if(DEFINED BUILD_WININST) + message(AUTHOR_WARNING "BUILD_WININST option is *NOT* supported with Python >= 3.10. Current version is ${PY_VERSION}") + message(AUTHOR_WARNING "Unsetting cache variable BUILD_WININST") + unset(BUILD_WININST CACHE) + endif() + if(DEFINED BUILD_WININST_ALWAYS) + message(AUTHOR_WARNING "BUILD_WININST_ALWAYS option is *NOT* supported with Python >= 3.10. Current version is ${PY_VERSION}") + message(AUTHOR_WARNING "Unsetting cache variable BUILD_WININST_ALWAYS") + unset(BUILD_WININST_ALWAYS CACHE) + endif() +endif() + +if(WIN32 AND PY_VERSION VERSION_LESS "3.10") set(_build_wininst_default ON) if(CMAKE_CROSSCOMPILING) set(_build_wininst_default OFF) @@ -73,10 +91,10 @@ if(WIN32) option(BUILD_WININST "Build 'Windows Installer' program for distutils if not already provided in the source tree." ${_build_wininst_default}) cmake_dependent_option(BUILD_WININST_ALWAYS "Always build 'Windows installer' program even if provided in the source tree." OFF "BUILD_WININST" OFF) else() - set(INSTALL_WINDOWS_TRADITIONAL OFF) set(BUILD_WININST OFF) set(BUILD_WININST_ALWAYS OFF) endif() + option(INSTALL_DEVELOPMENT "Install files required to develop C extensions" ON) option(INSTALL_MANUAL "Install man files" ON) option(INSTALL_TEST "Install test files" ON) @@ -117,8 +135,7 @@ cmake_dependent_option(USE_SYSTEM_LIBMPDEC "Use system LIBMPDEC" OFF "USE_SYSTEM cmake_dependent_option(USE_BUILTIN_ZLIB "Use builtin ZLIB" ${_use_builtin_zlib_default} "NOT USE_SYSTEM_ZLIB" OFF) -cmake_dependent_option(USE_LIBEDIT "Use libedit instead of readline" OFF - "USE_SYSTEM_READLINE" OFF) +option(USE_LIBEDIT "Use libedit instead of readline" OFF) option(WITH_TSC "profile with the Pentium timestamp counter" OFF) option(ENABLE_IPV6 "Enable IP v6" ON) @@ -261,6 +278,25 @@ set(_download_3.9.19_md5 "b4d723903d0a8266b110c3da2f992416") set(_download_3.9.20_md5 "896c19e5815ba990a3d1261502ea9f83") set(_download_3.9.21_md5 "e61b3568082b57d55fd74cfc7ca020b4") set(_download_3.9.22_md5 "8fe76e248a0e149ac23e8e4886397475") +# 3.10.x +set(_download_3.10.0_md5 "729e36388ae9a832b01cf9138921b383") +set(_download_3.10.1_md5 "91822157a97da16203877400c810d93e") +set(_download_3.10.2_md5 "67c92270be6701f4a6fed57c4530139b") +set(_download_3.10.3_md5 "f276ffcd05bccafe46da023d0a5bb04a") +set(_download_3.10.4_md5 "7011fa5e61dc467ac9a98c3d62cfe2be") +set(_download_3.10.5_md5 "d87193c077541e22f892ff1353fac76c") +set(_download_3.10.6_md5 "d76638ca8bf57e44ef0841d2cde557a0") +set(_download_3.10.7_md5 "1aea68575c0e97bc83ff8225977b0d46") +set(_download_3.10.8_md5 "fbe3fff11893916ad1756b15c8a48834") +set(_download_3.10.9_md5 "25eb3686327c157dcb8ac9f01105c306") +set(_download_3.10.10_md5 "6dbe644dd1a520d9853cf6648084c346") +set(_download_3.10.11_md5 "7e25e2f158b1259e271a45a249cb24bb") +set(_download_3.10.12_md5 "1d64320e0b0df6e9ab7e611bacb2178d") +set(_download_3.10.13_md5 "cbcad7f5e759176bf8ce8a5f9d487087") +set(_download_3.10.14_md5 "f67d78c8323a18fe6b945914c51a7aa6") +set(_download_3.10.15_md5 "b6a2b570ea75ef55f50bfe79d778eb01") +set(_download_3.10.16_md5 "2515d8571c6fdd7fc620aa9e1cc6d202") +set(_download_3.10.17_md5 "763324aa2b396ee10a51bfa6c645d8e9") set(_extracted_dir "Python-${PY_VERSION}") @@ -376,6 +412,14 @@ else() endif() endif() +if(PY_VERSION VERSION_GREATER_EQUAL "3.10") + option(WITH_VALGRIND "Enable to disable pymalloc when running under valgrind" OFF) +else() + if(DEFINED WITH_VALGRIND) + message(AUTHOR_WARNING "WITH_VALGRIND option is *NOT* supported with Python < 3.10. Current version is ${PY_VERSION}") + endif() +endif() + if(PY_VERSION VERSION_GREATER_EQUAL "3.7") set(WITH_SSL_DEFAULT_SUITES "python" CACHE STRING "Override default cipher suites string: python, openssl or a custom string") if("${WITH_SSL_DEFAULT_SUITES}" STREQUAL "python") diff --git a/README.rst b/README.rst index 03bf88497..06eadaa6c 100644 --- a/README.rst +++ b/README.rst @@ -59,7 +59,7 @@ How to use this buildsystem: .. note:: - By default, the build system will download the python 3.9.22 source from + By default, the build system will download the python 3.10.17 source from http://www.python.org/ftp/python/ @@ -72,7 +72,7 @@ options on the commandline with `-DOPTION=VALUE`, or use the "ccmake" gui. :: - PYTHON_VERSION=major.minor.patch (defaults to 3.9.22) + PYTHON_VERSION=major.minor.patch (defaults to 3.10.17) The version of Python to build. PYTHON_APPLY_PATCHES=ON|OFF (defaults to ON) diff --git a/cmake/ConfigureChecks.cmake b/cmake/ConfigureChecks.cmake index ea5512803..79b2cb2f1 100644 --- a/cmake/ConfigureChecks.cmake +++ b/cmake/ConfigureChecks.cmake @@ -292,6 +292,7 @@ check_include_files(langinfo.h HAVE_LANGINFO_H) check_include_files(libintl.h HAVE_LIBINTL_H) check_include_files(libutil.h HAVE_LIBUTIL_H) check_include_files(linux/tipc.h HAVE_LINUX_TIPC_H) +check_include_files(linux/auxvec.h HAVE_LINUX_AUXVEC_H) # Python 3.10 check_include_files(locale.h HAVE_LOCALE_H) check_include_files(sys/socket.h HAVE_SYS_SOCKET_H) @@ -334,7 +335,11 @@ check_include_files(process.h HAVE_PROCESS_H) check_include_files(pthread.h HAVE_PTHREAD_H) check_include_files(pty.h HAVE_PTY_H) check_include_files(pwd.h HAVE_PWD_H) -check_include_files("stdio.h;readline/readline.h" HAVE_READLINE_READLINE_H) +if(USE_LIBEDIT) + check_include_files("stdio.h;editline/readline.h" HAVE_READLINE_READLINE_H) +else() + check_include_files("stdio.h;readline/readline.h" HAVE_READLINE_READLINE_H) +endif() check_include_files(semaphore.h HAVE_SEMAPHORE_H) check_include_files(shadow.h HAVE_SHADOW_H) check_include_files(signal.h HAVE_SIGNAL_H) @@ -346,8 +351,10 @@ check_include_files(string.h HAVE_STRING_H) # libffi and cpython check_include_files(stropts.h HAVE_STROPTS_H) check_include_files(sysexits.h HAVE_SYSEXITS_H) check_include_files(sys/audioio.h HAVE_SYS_AUDIOIO_H) +check_include_files(sys/auxv.h HAVE_SYS_AUXV_H) # Python 3.10 check_include_files(sys/bsdtty.h HAVE_SYS_BSDTTY_H) check_include_files(sys/epoll.h HAVE_SYS_EPOLL_H) +check_include_files(sys/eventfd.h HAVE_SYS_EVENTFD_H) # Python 3.10 check_include_files(sys/event.h HAVE_SYS_EVENT_H) check_include_files(sys/file.h HAVE_SYS_FILE_H) check_include_files(sys/loadavg.h HAVE_SYS_LOADAVG_H) @@ -432,7 +439,11 @@ endif() find_library(HAVE_LIBNCURSES ncurses) find_library(HAVE_LIBNSL nsl) -find_library(HAVE_LIBREADLINE readline) +if(USE_LIBEDIT) + find_library(HAVE_LIBREADLINE edit) +else() + find_library(HAVE_LIBREADLINE readline) +endif() find_library(HAVE_LIBSENDFILE sendfile) find_library(HAVE_LIBTERMCAP termcap) @@ -477,6 +488,16 @@ if(WITH_THREAD OR PY_VERSION VERSION_GREATER_EQUAL "3.7") endif() endif() +if(WITH_VALGRIND AND PY_VERSION VERSION_GREATER_EQUAL "3.10") + check_include_files(valgrind/valgrind.h HAVE_VALGRIND_VALGRIND_H) + if(NOT HAVE_VALGRIND_VALGRIND_H) + message(FATAL_ERROR "Valgrind support requested but headers not available") + endif() + set(DYNAMIC_ANNOTATIONS_ENABLED 1) +else() + set(DYNAMIC_ANNOTATIONS_ENABLED 0) +endif() + set(check_src ${PROJECT_BINARY_DIR}/CMakeFiles/ac_cv_lib_crypto_RAND_egd.c) file(WRITE ${check_src} "/* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC @@ -696,6 +717,7 @@ check_type_size(float SIZEOF_FLOAT) check_type_size(fpos_t SIZEOF_FPOS_T) check_type_size(int SIZEOF_INT) check_type_size(long SIZEOF_LONG) +check_type_size(long ALIGNOF_LONG) # Python 3.10 check_type_size("long double" SIZEOF_LONG_DOUBLE) set(HAVE_LONG_DOUBLE ${SIZEOF_LONG_DOUBLE}) # libffi and cpython check_type_size("long long" SIZEOF_LONG_LONG) @@ -705,6 +727,7 @@ check_type_size(pid_t SIZEOF_PID_T) check_type_size(pthread_t SIZEOF_PTHREAD_T) check_type_size(short SIZEOF_SHORT) check_type_size(size_t SIZEOF_SIZE_T) +check_type_size(size_t ALIGNOF_SIZE_T) # Python 3.10 check_type_size(ssize_t HAVE_SSIZE_T) check_type_size(time_t SIZEOF_TIME_T) check_type_size(uintptr_t SIZEOF_UINTPTR_T) @@ -903,6 +926,7 @@ check_symbol_exists(siginterrupt "${CFG_HEADERS}" HAVE_SIGINTERRUPT) check_symbol_exists(sigrelse "${CFG_HEADERS}" HAVE_SIGRELSE) check_symbol_exists(snprintf "${CFG_HEADERS}" HAVE_SNPRINTF) check_symbol_exists(socketpair "${CFG_HEADERS}" HAVE_SOCKETPAIR) +check_symbol_exists(splice "${CFG_HEADERS}" HAVE_SPLICE) # Python 3.10 check_symbol_exists(statvfs "${CFG_HEADERS}" HAVE_STATVFS) check_symbol_exists(strdup "${CFG_HEADERS}" HAVE_STRDUP) check_symbol_exists(strftime "${CFG_HEADERS}" HAVE_STRFTIME) @@ -927,11 +951,13 @@ check_symbol_exists(wcscoll "${CFG_HEADERS}" HAVE_WCSCOLL) check_symbol_exists(_getpty "${CFG_HEADERS}" HAVE__GETPTY) check_symbol_exists(accept4 "${CFG_HEADERS}" HAVE_ACCEPT4) +check_symbol_exists(close_range "${CFG_HEADERS}" HAVE_CLOSE_RANGE) # Python 3.10 check_symbol_exists(copy_file_range "${CFG_HEADERS}" HAVE_COPY_FILE_RANGE) check_symbol_exists(dup3 "${CFG_HEADERS}" HAVE_DUP3) check_symbol_exists(_dyld_shared_cache_contains_path "${CFG_HEADERS}" HAVE_DYLD_SHARED_CACHE_CONTAINS_PATH) check_symbol_exists(explicit_bzero "${CFG_HEADERS}" HAVE_EXPLICIT_BZERO) check_symbol_exists(explicit_memset "${CFG_HEADERS}" HAVE_EXPLICIT_MEMSET) +check_symbol_exists(eventfd "${CFG_HEADERS}" HAVE_EVENTFD) # Python 3.10 check_symbol_exists(faccessat "${CFG_HEADERS}" HAVE_FACCESSAT) check_symbol_exists(fchmodat "${CFG_HEADERS}" HAVE_FCHMODAT) check_symbol_exists(fchownat "${CFG_HEADERS}" HAVE_FCHOWNAT) @@ -1004,6 +1030,7 @@ check_symbol_exists(symlinkat "${CFG_HEADERS}" HAVE_SYMLINKAT) check_symbol_exists(sync "${CFG_HEADERS}" HAVE_SYNC) check_symbol_exists(unlinkat "${CFG_HEADERS}" HAVE_UNLINKAT) check_symbol_exists(utimensat "${CFG_HEADERS}" HAVE_UTIMENSAT) +check_symbol_exists(vfork "${CFG_HEADERS}" HAVE_VFORK) # Python 3.10 check_symbol_exists(waitid "${CFG_HEADERS}" HAVE_WAITID) check_symbol_exists(wcsftime "${CFG_HEADERS}" HAVE_WCSFTIME) check_symbol_exists(wcsxfrm "${CFG_HEADERS}" HAVE_WCSXFRM) @@ -1989,7 +2016,11 @@ if(HAVE_READLINE_READLINE_H) cmake_push_check_state() set(CFG_HEADERS_SAVE ${CFG_HEADERS}) - add_cond(CFG_HEADERS HAVE_READLINE_READLINE_H readline/readline.h) + if(USE_LIBEDIT) + add_cond(CFG_HEADERS HAVE_READLINE_READLINE_H "editline/readline.h") + else() + add_cond(CFG_HEADERS HAVE_READLINE_READLINE_H "readline/readline.h") + endif() add_cond(CMAKE_REQUIRED_LIBRARIES HAVE_LIBREADLINE ${HAVE_LIBREADLINE}) check_symbol_exists(rl_callback_handler_install "${CFG_HEADERS}" HAVE_RL_CALLBACK) check_symbol_exists(rl_catch_signals "${CFG_HEADERS}" HAVE_RL_CATCH_SIGNAL) diff --git a/cmake/config-mingw/pyconfig.h b/cmake/config-mingw/pyconfig.h index 5daf76fcf..ec2a9cb7b 100644 --- a/cmake/config-mingw/pyconfig.h +++ b/cmake/config-mingw/pyconfig.h @@ -187,6 +187,7 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */ # define SIZEOF_FPOS_T 8 # define SIZEOF_HKEY 8 # define SIZEOF_SIZE_T 8 +# define ALIGNOF_SIZE_T 8 /* configure.ac defines HAVE_LARGEFILE_SUPPORT iff HAVE_LONG_LONG, sizeof(off_t) > sizeof(long), and sizeof(PY_LONG_LONG) >= sizeof(off_t). On Win64 the second condition is not true, but if fpos_t replaces off_t @@ -200,6 +201,7 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */ # define SIZEOF_FPOS_T 8 # define SIZEOF_HKEY 4 # define SIZEOF_SIZE_T 4 +# define ALIGNOF_SIZE_T 4 # define SIZEOF_TIME_T 8 #endif @@ -213,6 +215,7 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */ #define SIZEOF_SHORT 2 #define SIZEOF_INT 4 #define SIZEOF_LONG 4 +#define ALIGNOF_LONG 4 #define SIZEOF_LONG_LONG 8 #define SIZEOF_DOUBLE 8 #define SIZEOF_FLOAT 4 diff --git a/cmake/config-unix/pyconfig.h.in b/cmake/config-unix/pyconfig.h.in index 8726a41f7..3c1180799 100644 --- a/cmake/config-unix/pyconfig.h.in +++ b/cmake/config-unix/pyconfig.h.in @@ -17,6 +17,12 @@ support for AIX C++ shared extension modules. */ #cmakedefine AIX_GENUINE_CPLUSPLUS 1 +/* The normal alignment of `long', in bytes. [Python 3.10] */ +#cmakedefine ALIGNOF_LONG @SIZEOF_LONG@ + +/* The normal alignment of `size_t', in bytes. [Python 3.10] */ +#cmakedefine ALIGNOF_SIZE_T @SIZEOF_SIZE_T@ + /* Alternative SOABI used in debug build to load C extensions built in release mode [Python 3.8] */ #cmakedefine ALT_SOABI 1 @@ -144,6 +150,9 @@ /* Define to 1 if you have the `clock_settime' function. [Python 3.6] */ #cmakedefine HAVE_CLOCK_SETTIME 1 +/* Define to 1 if you have the `close_range' function. [Python 3.10] */ +#cmakedefine HAVE_CLOSE_RANGE 1 + /* Define if the C compiler supports computed gotos. */ #cmakedefine HAVE_COMPUTED_GOTOS 1 @@ -313,6 +322,9 @@ /* Define to 1 if you have the header file. */ #cmakedefine HAVE_ERRNO_H 1 +/* Define if you have the 'eventfd' function. [Python 3.10] */ +#cmakedefine HAVE_EVENTFD 1 + /* Define to 1 if you have the `execv' function. */ #cmakedefine HAVE_EXECV 1 @@ -639,6 +651,9 @@ /* Define to 1 if you have the `linkat' function. [Python 3] */ #cmakedefine HAVE_LINKAT 1 +/* Define to 1 if you have the header file. [Python 3.10] */ +#cmakedefine HAVE_LINUX_AUXVEC_H 1 + /* Define to 1 if you have the header file. [Python 3] */ #cmakedefine HAVE_LINUX_CAN_BCM_H 1 @@ -1066,6 +1081,9 @@ /* Define to 1 if you have the header file. */ #cmakedefine HAVE_SPAWN_H 1 +/* Define to 1 if you have the `splice' function. [Python 3.10] */ +#cmakedefine HAVE_SPLICE 1 + /* Define if your compiler provides ssize_t */ #cmakedefine HAVE_SSIZE_T 1 @@ -1161,6 +1179,9 @@ /* Define to 1 if you have the header file. */ #cmakedefine HAVE_SYS_AUDIOIO_H 1 +/* Define to 1 if you have the header file. [Python 3.10] */ +#cmakedefine HAVE_SYS_AUXV_H 1 + /* Define to 1 if you have the header file. */ #cmakedefine HAVE_SYS_BSDTTY_H 1 @@ -1177,6 +1198,9 @@ /* Define to 1 if you have the header file. */ #cmakedefine HAVE_SYS_EPOLL_H 1 +/* Define to 1 if you have the header file. [Python 3.10] */ +#cmakedefine HAVE_SYS_EVENTFD_H 1 + /* Define to 1 if you have the header file. */ #cmakedefine HAVE_SYS_EVENT_H 1 @@ -1374,6 +1398,9 @@ /* Define to 1 if you have the header file. [Python 3.7] */ #cmakedefine HAVE_UUID_UUID_H 1 +/* Define to 1 if you have the `vfork' function. [Python 3.10] */ +#cmakedefine HAVE_VFORK 1 + /* Define to 1 if you have the `wait3' function. */ #cmakedefine HAVE_WAIT3 1 @@ -1639,6 +1666,9 @@ Dyld is necessary to support frameworks. */ #cmakedefine WITH_DYLD 1 +/* Define to build the readline module against Editline. [Python 3.10] */ +#cmakedefine WITH_EDITLINE 1 + /* Define to 1 if libintl is needed for locale functions. */ #cmakedefine WITH_LIBINTL 1 @@ -1649,6 +1679,9 @@ /* Define if you want to compile in Python-specific mallocs */ #cmakedefine WITH_PYMALLOC 1 +/* Define if you want pymalloc to be disabled when running under valgrind [Python 3.10] */ +#cmakedefine WITH_VALGRIND 1 + /* Define if you want to compile in rudimentary thread support */ #cmakedefine WITH_THREAD 1 @@ -1814,5 +1847,7 @@ #define PLATLIBDIR "lib" +#cmakedefine DYNAMIC_ANNOTATIONS_ENABLED 1 + #endif /*Py_PYCONFIG_H*/ diff --git a/cmake/extensions/CMakeLists.txt b/cmake/extensions/CMakeLists.txt index 601ef360a..7eb86d3d1 100644 --- a/cmake/extensions/CMakeLists.txt +++ b/cmake/extensions/CMakeLists.txt @@ -8,6 +8,10 @@ set(IS_PY_LESS_3_8 0) if(PY_VERSION VERSION_LESS "3.8") set(IS_PY_LESS_3_8 1) endif() +set(IS_PY_LESS_3_10 0) +if(PY_VERSION VERSION_LESS "3.10") + set(IS_PY_LESS_3_10 1) +endif() set(IS_PY3_3_OR_GREATER 0) if(PY_VERSION VERSION_GREATER_EQUAL "3.3") @@ -128,6 +132,8 @@ add_python_extension(math ${WIN32_BUILTIN} add_python_extension(mmap ${WIN32_BUILTIN} SOURCES mmapmodule.c) add_python_extension(_multibytecodec ${WIN32_BUILTIN} SOURCES cjkcodecs/multibytecodec.c) add_python_extension(parser ${WIN32_BUILTIN} + REQUIRES + IS_PY_LESS_3_10 SOURCES parsermodule.c ) @@ -332,10 +338,27 @@ add_python_extension(_testinternalcapi add_python_extension(_peg_parser ALWAYS_BUILTIN REQUIRES IS_PY3_9_OR_GREATER + IS_PY_LESS_3_10 SOURCES _peg_parser.c ) +# Python Argument Clinic functional test module +add_python_extension(_testclinic + REQUIRES + "PY_VERSION VERSION_GREATER_EQUAL 3.10.10" + SOURCES + _testclinic.c +) + +# Python interface to subinterpreter C-API. +add_python_extension(_xxsubinterpreters ${WIN32_BUILTIN} + REQUIRES + IS_PY3_8_OR_GREATER + SOURCES + _xxsubinterpretersmodule.c +) + # UNIX-only extensions add_python_extension(fcntl REQUIRES UNIX SOURCES fcntlmodule.c) add_python_extension(grp REQUIRES UNIX SOURCES grpmodule.c) @@ -924,7 +947,9 @@ add_python_extension(_lzma ) set(readline_DEFINITIONS "") if(USE_LIBEDIT) - list(APPEND readline_DEFINITIONS USE_LIBEDIT) + if(PY_VERSION VERSION_GREATER_EQUAL "3.10") + list(APPEND readline_DEFINITIONS WITH_EDITLINE) + endif() endif() add_python_extension(readline REQUIRES READLINE_INCLUDE_PATH READLINE_LIBRARY CURSES_LIBRARIES HAVE_READLINE_READLINE_H diff --git a/cmake/libpython/CMakeLists.txt b/cmake/libpython/CMakeLists.txt index 059a327b8..35e4bf3ed 100644 --- a/cmake/libpython/CMakeLists.txt +++ b/cmake/libpython/CMakeLists.txt @@ -66,10 +66,6 @@ elseif(WIN32) endif() set(PARSER_COMMON_SOURCES # Equivalent to POBJS in Makefile.pre - ${SRC_DIR}/Parser/acceler.c - ${SRC_DIR}/Parser/grammar1.c - ${SRC_DIR}/Parser/listnode.c - ${SRC_DIR}/Parser/node.c ${SRC_DIR}/Parser/parser.c # Removed in Python 3.8 @@ -81,15 +77,28 @@ set(PARSER_COMMON_SOURCES # Equivalent to POBJS in Makefile.pre # Introduced in Python 3.8 $<$:${SRC_DIR}/Parser/myreadline.c> - $<$:${SRC_DIR}/Parser/parsetok.c> $<$:${SRC_DIR}/Parser/token.c> $<$:${SRC_DIR}/Parser/tokenizer.c> - # Introduced in Python 3.9 - $<$:${SRC_DIR}/Parser/pegen/pegen.c> - $<$:${SRC_DIR}/Parser/pegen/parse.c> - $<$:${SRC_DIR}/Parser/pegen/parse_string.c> - $<$:${SRC_DIR}/Parser/pegen/peg_api.c> + # Introduced in Python 3.8 and removed in Python 3.10 + $<$,$>:${SRC_DIR}/Parser/parsetok.c> + + # Introduced in Python 3.9 and removed in Python 3.10 + $<$:${SRC_DIR}/Parser/pegen/pegen.c> + $<$:${SRC_DIR}/Parser/pegen/parse.c> + $<$:${SRC_DIR}/Parser/pegen/parse_string.c> + $<$:${SRC_DIR}/Parser/pegen/peg_api.c> + + # Removed in Python 3.10 + $<$:${SRC_DIR}/Parser/acceler.c> + $<$:${SRC_DIR}/Parser/grammar1.c> + $<$:${SRC_DIR}/Parser/listnode.c> + $<$:${SRC_DIR}/Parser/node.c> + + # Introduced in Python 3.10 + $<$:${SRC_DIR}/Parser/peg_api.c> + $<$:${SRC_DIR}/Parser/pegen.c> + $<$:${SRC_DIR}/Parser/string_parser.c> ) set(OBJECT_COMMON_SOURCES # Equivalent to OBJECT_OBJS in Makefile.pre @@ -147,6 +156,9 @@ set(OBJECT_COMMON_SOURCES # Equivalent to OBJECT_OBJS in Makefile.pre # Introduced in Python 3.9 $<$:${SRC_DIR}/Objects/genericaliasobject.c> + + # Introduced in Python 3.10 + $<$:${SRC_DIR}/Objects/unionobject.c> ) if(CMAKE_C_COMPILER_ID MATCHES GNU) @@ -206,14 +218,12 @@ set(PYTHON_COMMON_SOURCES ${SRC_DIR}/Python/getopt.c ${SRC_DIR}/Python/getplatform.c ${SRC_DIR}/Python/getversion.c - ${SRC_DIR}/Python/graminit.c ${SRC_DIR}/Python/import.c ${SRC_DIR}/Python/importdl.c ${SRC_DIR}/Python/marshal.c ${SRC_DIR}/Python/modsupport.c ${SRC_DIR}/Python/mysnprintf.c ${SRC_DIR}/Python/mystrtoul.c - ${SRC_DIR}/Python/peephole.c ${SRC_DIR}/Python/pyarena.c ${SRC_DIR}/Python/pyctype.c ${SRC_DIR}/Python/pyfpe.c @@ -250,6 +260,13 @@ set(PYTHON_COMMON_SOURCES # Introduced in Python 3.8 $<$:${SRC_DIR}/Python/initconfig.c> $<$:${SRC_DIR}/Python/preconfig.c> + + # Removed in Python 3.10 + $<$:${SRC_DIR}/Python/graminit.c> + $<$:${SRC_DIR}/Python/peephole.c> + + # Introduced in Python 3.10 + $<$:${SRC_DIR}/Python/suggestions.c> ) if(UNIX) @@ -275,6 +292,15 @@ if(UNIX OR MINGW) ) endif() +# Introduced in Python 3.10 and removed in Python 3.11 +if(WIN32 AND "${PY_VERSION_MAJOR}.${PY_VERSION_MINOR}" VERSION_EQUAL "3.10") + set_property( + SOURCE ${SRC_DIR}/Python/pathconfig.c + PROPERTY COMPILE_DEFINITIONS + "PY3_DLLNAME=\"python3$<$:_d>\"" + ) +endif() + list(APPEND MODULE_SOURCES ${SRC_DIR}/Modules/signalmodule.c ) @@ -528,7 +554,7 @@ if(BUILD_LIBPYTHON_SHARED) set(targetname "libpython3-shared") - if(MSVC) + if(MSVC AND PY_VERSION VERSION_LESS "3.10") # XXX Add BuildPython3_dDef # Generate 'python3stub.def' @@ -559,11 +585,15 @@ if(BUILD_LIBPYTHON_SHARED) VERBATIM ) add_custom_target(generate_libpython3stub_lib DEPENDS ${python3stub_lib}) + endif() + if(MSVC) # Build 'python3.dll' add_library(${targetname} SHARED ${SRC_DIR}/PC/python3dll.c - ${SRC_DIR}/PC/python3.def + + # Removed in Python 3.10 + $<$:${SRC_DIR}/PC/python3.def> ) set_target_properties(${targetname} PROPERTIES OUTPUT_NAME python3 @@ -571,11 +601,24 @@ if(BUILD_LIBPYTHON_SHARED) RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/${LIBPYTHON_LIBDIR} INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/${LIBPYTHON_LIBDIR} ) - add_dependencies(${targetname} generate_libpython3stub_lib) + if(PY_VERSION VERSION_LESS "3.10") + add_dependencies(${targetname} generate_libpython3stub_lib) + endif() target_link_libraries(${targetname} - ${python3stub_lib} + libpython-shared + + # Removed in Python 3.10 + $<$:${python3stub_lib}> ) + + if(PY_VERSION VERSION_GREATER_EQUAL "3.10") + set_property( + SOURCE ${SRC_DIR}/PC/python3dll.c + PROPERTY COMPILE_DEFINITIONS + "PYTHON_DLL_NAME=\"python${PY_VERSION_MAJOR}${PY_VERSION_MINOR}$<$:_d>\"" + ) + endif() endif() if(UNIX AND NOT APPLE) diff --git a/cmake/patches/01-readline-libedit.patch b/cmake/patches/01-readline-libedit.patch deleted file mode 100644 index 1361fdd7e..000000000 --- a/cmake/patches/01-readline-libedit.patch +++ /dev/null @@ -1,30 +0,0 @@ ---- Python-2.7.1/Modules/readline.c 2012-06-12 13:11:22.196147749 +0100 -+++ python-cmake-buildsystem/Modules/readline.c 2012-06-12 13:10:50.823145298 +0100 -@@ -28,8 +28,15 @@ - - /* GNU readline definitions */ - #undef HAVE_CONFIG_H /* Else readline/chardefs.h includes strings.h */ --#include --#include -+ -+#ifdef USE_LIBEDIT -+# include -+#else -+# include -+# include -+# define HAVE_RL_COMPLETION_SUPPRESS_APPEND -+# define HAVE_RL_CATCH_SIGNAL -+#endif - - #ifdef HAVE_RL_COMPLETION_MATCHES - #define completion_matches(x, y) \ -@@ -963,7 +970,9 @@ - PyEval_SaveThread(); - #endif - if (s < 0) { -+#ifndef USE_LIBEDIT - rl_free_line_state(); -+#endif - rl_cleanup_after_signal(); - rl_callback_handler_remove(); - *signal = 1;