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

Python 3.13 #28

Merged
merged 47 commits into from
Dec 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
4f41202
add 3.13.0
bjia56 Oct 15, 2024
b1ed601
roll forward existing patches
bjia56 Oct 15, 2024
3da020f
run_tests.py was removed in 3.13
bjia56 Oct 15, 2024
c816151
update freebsd patch
bjia56 Oct 15, 2024
bd618fb
_msi.c removed in 3.13
bjia56 Oct 15, 2024
225feae
Merge branch 'portable-python' into python3.13
bjia56 Nov 27, 2024
6c49280
Merge branch 'portable-python' into python3.13
bjia56 Dec 11, 2024
a0b8444
disable other versions
bjia56 Dec 12, 2024
d8418e3
roll patches forward
bjia56 Dec 12, 2024
001f7e0
remove dead batteries modules
bjia56 Dec 12, 2024
d718c4b
update tokenizer sources
bjia56 Dec 12, 2024
f5da924
update _testcapi
bjia56 Dec 12, 2024
7dd1531
update sources
bjia56 Dec 12, 2024
5e629a6
detect various ncurses headers
bjia56 Dec 12, 2024
e2b08e5
add missing sources
bjia56 Dec 12, 2024
51666e3
free threading
bjia56 Dec 12, 2024
ace3eaf
add missing sources
bjia56 Dec 12, 2024
95953d0
add missing sources
bjia56 Dec 12, 2024
e23b76b
add missing sources
bjia56 Dec 12, 2024
5e8118a
patch deepfreeze.py to create missing parent dirs
bjia56 Dec 12, 2024
8eb9e53
patch getpath to use relative header
bjia56 Dec 12, 2024
4e423c7
update portable patches
bjia56 Dec 12, 2024
015cd69
remove dead batteries
bjia56 Dec 12, 2024
1bb1e99
update testinternalcapi
bjia56 Dec 12, 2024
728cf08
add missing source
bjia56 Dec 12, 2024
83ffff2
dos2unix
bjia56 Dec 12, 2024
e6d2958
fix gettimeofday
bjia56 Dec 13, 2024
4f20041
use different freeze script
bjia56 Dec 13, 2024
9c709a9
syntax
bjia56 Dec 13, 2024
b68efb5
Revert "syntax"
bjia56 Dec 13, 2024
9c8b698
Revert "use different freeze script"
bjia56 Dec 13, 2024
0fe1219
dos2unix
bjia56 Dec 13, 2024
28bbbee
deepfreeze.c is no longer needed? + reindent
bjia56 Dec 13, 2024
845b26c
remove unused patch
bjia56 Dec 13, 2024
128e75d
copy over windows pyconfig.h.in
bjia56 Dec 13, 2024
e95844f
include mimalloc
bjia56 Dec 13, 2024
158aa46
remove freebsd errno patch
bjia56 Dec 13, 2024
65f4ceb
Revert "remove freebsd errno patch"
bjia56 Dec 13, 2024
c67404c
update errno patch
bjia56 Dec 13, 2024
711d2b5
Revert "update errno patch"
bjia56 Dec 14, 2024
f0a0935
Revert "Revert "remove freebsd errno patch""
bjia56 Dec 14, 2024
79134fe
update freebsd errno patch
bjia56 Dec 14, 2024
aec043a
update errno patches
bjia56 Dec 14, 2024
f6e1a9b
Revert "update errno patches"
bjia56 Dec 14, 2024
f0d59db
Revert "update freebsd errno patch"
bjia56 Dec 14, 2024
c966fd2
Revert "Revert "Revert "remove freebsd errno patch"""
bjia56 Dec 14, 2024
b339e3d
override errno hacks
bjia56 Dec 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ jobs:
strategy:
fail-fast: true
matrix:
python-version: [3.9.21, 3.10.16, 3.11.11, 3.12.8]
#python-version: [3.9.21, 3.10.16, 3.11.11, 3.12.8, 3.13.0]
python-version: [3.13.0]
os: [ubuntu]
include:
- os: ubuntu
Expand Down
13 changes: 13 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ if(UNIX)
else()
set(WITH_STATIC_DEPENDENCIES 0)
endif()
if(PY_VERSION VERSION_GREATER_EQUAL "3.13")
option(WITH_FREE_THREADING "Enable experimental free-threaded build and disables the GIL" OFF)
endif()

# Detect source directory
set(_landmark "pyconfig.h.in") # CMake will look for this file.
Expand Down Expand Up @@ -335,6 +338,8 @@ set(_download_3.12.5_md5 "d23d56b51d36a9d51b2b13d30c849d00")
set(_download_3.12.6_md5 "c2f1dd5c8807ee50b778684b7958ee28")
set(_download_3.12.7_md5 "5d0c0e4c6a022a87165a9addcd869109")
set(_download_3.12.8_md5 "304473cf367fa65e450edf4b06b55fcc")
# 3.13.x
set(_download_3.13.0_md5 "c29f37220520ec6075fc37d4c62e178b")

set(_extracted_dir "Python-${PY_VERSION}")

Expand Down Expand Up @@ -586,6 +591,14 @@ if(UNIX)
configure_file(cmake/config-unix/pyconfig.h.in
${PYCONFIG_BUILD_DIR}/pyconfig.h)
elseif(WIN32)
if(PY_VERSION VERSION_GREATER_EQUAL "3.13")
file(READ ${SRC_DIR}/PC/pyconfig.h.in PYCONFIG_H_CONTENTS)
if(WITH_FREE_THREADING)
string(REPLACE "/* #define Py_GIL_DISABLED 1 */" "#define Py_GIL_DISABLED 1" PYCONFIG_H_CONTENTS "${PYCONFIG_H_CONTENTS}")
endif()
file(WRITE ${SRC_DIR}/PC/pyconfig.h "${PYCONFIG_H_CONTENTS}")
endif()

set(PYCONFIG_BUILD_DIR ${SRC_DIR}/PC) # In a windows build tree, 'pyconfig.h' is NOT required to
# live along side the python executable.
# See function '_init_posix()' and '_init_non_posix()'
Expand Down
4 changes: 4 additions & 0 deletions cmake/ConfigureChecks.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,9 @@ endif()
if(WITH_PYMALLOC AND PY_VERSION VERSION_LESS "3.8")
set(ABIFLAGS "${ABIFLAGS}m")
endif()
if(WITH_FREE_THREADING AND PY_VERSION VERSION_GREATER_EQUAL "3.13")
set(ABIFLAGS "${ABIFLAGS}t")
endif()
message(STATUS "${_msg} - ${ABIFLAGS}")

set(_msg "Checking PLATFORM_TRIPLET")
Expand Down Expand Up @@ -326,6 +329,7 @@ check_include_files(memory.h HAVE_MEMORY_H) # libffi and cpython
check_include_files(minix/config.h HAVE_MINIX_CONFIG_H)
check_include_files(ncurses.h HAVE_NCURSES_H)
check_include_files(ncurses/panel.h HAVE_NCURSES_PANEL_H)
check_include_files(ncursesw/panel.h HAVE_NCURSESW_PANEL_H)
check_include_files(netdb.h HAVE_NETDB_H)
check_include_files(netinet/in.h HAVE_NETINET_IN_H)
check_include_files(netpacket/packet.h HAVE_NETPACKET_PACKET_H)
Expand Down
9 changes: 9 additions & 0 deletions cmake/config-unix/pyconfig.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,15 @@
/* Define to 1 if you have the <ncurses.h> header file. */
#cmakedefine HAVE_NCURSES_H 1

/* Define to 1 if you have the <ncurses/panel.h> header file. */
#cmakedefine HAVE_NCURSES_PANEL_H 1

/* Define to 1 if you have the <ncursesw/panel.h> header file. */
#cmakedefine HAVE_NCURSESW_PANEL_H 1

/* Define to 1 if you have the <panel.h> header file. */
#cmakedefine HAVE_PANEL_H 1

/* Define to 1 if you have the <netdb.h> header file. */
#cmakedefine HAVE_NETDB_H 1

Expand Down
144 changes: 90 additions & 54 deletions cmake/extensions/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,14 @@ if(Cosmopolitan)
set(NOT_COSMOPOLITAN 0)
endif()

if(WITH_FREE_THREADING)
add_definitions(-DPy_GIL_DISABLED)
endif()

add_python_extension(array ${WIN32_BUILTIN} SOURCES arraymodule.c)
add_python_extension(audioop ${WIN32_BUILTIN} REQUIRES HAVE_LIBM SOURCES audioop.c LIBRARIES ${M_LIBRARIES})
if(PY_VERSION VERSION_LESS "3.13")
add_python_extension(audioop ${WIN32_BUILTIN} REQUIRES HAVE_LIBM SOURCES audioop.c LIBRARIES ${M_LIBRARIES})
endif()
add_python_extension(_bisect ${WIN32_BUILTIN} SOURCES _bisectmodule.c)
add_python_extension(cmath REQUIRES HAVE_LIBM ${WIN32_BUILTIN} SOURCES $<$<VERSION_LESS:${PY_VERSION},3.11>:_math.c> cmathmodule.c LIBRARIES ${M_LIBRARIES})
add_python_extension(_codecs_cn ${WIN32_BUILTIN} SOURCES cjkcodecs/_codecs_cn.c)
Expand All @@ -27,11 +33,13 @@ add_python_extension(_codecs_kr ${WIN32_BUILTIN} SOURCES cjkcodecs/_codecs_kr.c)
add_python_extension(_codecs_tw ${WIN32_BUILTIN} SOURCES cjkcodecs/_codecs_tw.c)
add_python_extension(_collections ${WIN32_BUILTIN} ${PY3_BUILTIN} SOURCES _collectionsmodule.c) # Container types
add_python_extension(cPickle ${WIN32_BUILTIN} REQUIRES IS_PY2 SOURCES cPickle.c)
set(crypt2_NAME crypt)
set(crypt2_SOURCES cryptmodule.c)
set(crypt3_NAME _crypt)
set(crypt3_SOURCES _cryptmodule.c)
add_python_extension(${crypt${PY_VERSION_MAJOR}_NAME} REQUIRES HAVE_LIBCRYPT SOURCES ${crypt${PY_VERSION_MAJOR}_SOURCES} LIBRARIES ${HAVE_LIBCRYPT})
if(PY_VERSION VERSION_LESS "3.13")
set(crypt2_NAME crypt)
set(crypt2_SOURCES cryptmodule.c)
set(crypt3_NAME _crypt)
set(crypt3_SOURCES _cryptmodule.c)
add_python_extension(${crypt${PY_VERSION_MAJOR}_NAME} REQUIRES HAVE_LIBCRYPT SOURCES ${crypt${PY_VERSION_MAJOR}_SOURCES} LIBRARIES ${HAVE_LIBCRYPT})
endif()
add_python_extension(cStringIO ${WIN32_BUILTIN} REQUIRES IS_PY2 SOURCES cStringIO.c)
add_python_extension(_csv ${WIN32_BUILTIN} SOURCES _csv.c)
add_python_extension(_ctypes_test NEVER_BUILTIN REQUIRES HAVE_LIBM SOURCES _ctypes/_ctypes_test.c LIBRARIES ${M_LIBRARIES})
Expand Down Expand Up @@ -85,40 +93,51 @@ add_python_extension(strop ${WIN32_BUILTIN} REQUIRES IS_PY2 SOURCES stropmodule.
add_python_extension(_struct ${WIN32_BUILTIN} SOURCES _struct.c)
set(testcapi_SOURCES _testcapimodule.c)
if(PY_VERSION VERSION_GREATER_EQUAL "3.12")
list(APPEND testcapi_SOURCES
_testcapi/abstract.c
_testcapi/buffer.c
_testcapi/bytearray.c
_testcapi/bytes.c
_testcapi/code.c
_testcapi/codec.c
_testcapi/complex.c
_testcapi/datetime.c
_testcapi/dict.c
_testcapi/docstring.c
_testcapi/exceptions.c
_testcapi/file.c
_testcapi/float.c
_testcapi/gc.c
_testcapi/getargs.c
_testcapi/heaptype.c
_testcapi/heaptype_relative.c
_testcapi/immortal.c
_testcapi/list.c
_testcapi/long.c
_testcapi/mem.c
_testcapi/numbers.c
_testcapi/pyos.c
_testcapi/pytime.c
_testcapi/set.c
_testcapi/structmember.c
_testcapi/sys.c
_testcapi/tuple.c
_testcapi/unicode.c
_testcapi/vectorcall.c
_testcapi/vectorcall_limited.c
_testcapi/watchers.c
)
if(PY_VERSION VERSION_LESS "3.13")
list(APPEND testcapi_SOURCES
_testcapi/bytearray.c
_testcapi/heaptype_relative.c
_testcapi/pyos.c
_testcapi/pytime.c
_testcapi/sys.c
_testcapi/vectorcall_limited.c
)
else()
list(APPEND testcapi_SOURCES
_testcapi/hash.c
_testcapi/pyatomic.c
_testcapi/run.c
_testcapi/time.c
)
endif()
list(APPEND testcapi_SOURCES
_testcapi/abstract.c
_testcapi/buffer.c
_testcapi/bytes.c
_testcapi/code.c
_testcapi/codec.c
_testcapi/complex.c
_testcapi/datetime.c
_testcapi/dict.c
_testcapi/docstring.c
_testcapi/exceptions.c
_testcapi/file.c
_testcapi/float.c
_testcapi/gc.c
_testcapi/getargs.c
_testcapi/heaptype.c
_testcapi/immortal.c
_testcapi/list.c
_testcapi/long.c
_testcapi/mem.c
_testcapi/numbers.c
_testcapi/set.c
_testcapi/structmember.c
_testcapi/tuple.c
_testcapi/unicode.c
_testcapi/vectorcall.c
_testcapi/watchers.c
)
endif()
if(PY_VERSION VERSION_LESS "3.12" OR UNIX)
# This module seems to build incorrectly for Python 3.12 Windows
Expand Down Expand Up @@ -208,7 +227,16 @@ endif()

# Python 3.8
if(PY_VERSION VERSION_GREATER_EQUAL "3.8")
add_python_extension(_testinternalcapi SOURCES _testinternalcapi.c DEFINITIONS "PY3_DLLNAME=\"python3$<$<CONFIG:Debug>:_d>\"")
set(_testinternalcapi_SOURCES _testinternalcapi.c)
if(PY_VERSION VERSION_GREATER_EQUAL "3.13")
list(APPEND _testinternalcapi_SOURCES
_testinternalcapi/pytime.c
_testinternalcapi/set.c
_testinternalcapi/test_lock.c
_testinternalcapi/test_critical_sections.c
)
endif()
add_python_extension(_testinternalcapi SOURCES ${_testinternalcapi_SOURCES} DEFINITIONS "PY3_DLLNAME=\"python3$<$<CONFIG:Debug>:_d>\"")
endif()

# Python 3.9
Expand Down Expand Up @@ -237,17 +265,21 @@ if(TIRPC_LIBRARY AND TIRPC_RPC_INCLUDE_PATH)
list(APPEND nis_LIBRARIES ${TIRPC_STATIC_LIBRARIES})
endif()
endif()
add_python_extension(nis
REQUIRES ${nis_REQUIRES}
SOURCES nismodule.c
LIBRARIES ${nis_LIBRARIES}
INCLUDEDIRS ${nis_INCLUDEDIRS}
)
if(PY_VERSION VERSION_LESS "3.13")
add_python_extension(nis
REQUIRES ${nis_REQUIRES}
SOURCES nismodule.c
LIBRARIES ${nis_LIBRARIES}
INCLUDEDIRS ${nis_INCLUDEDIRS}
)
endif()

add_python_extension(posix REQUIRES UNIX ALWAYS_BUILTIN SOURCES posixmodule.c DEFINITIONS Py_BUILD_CORE)
add_python_extension(pwd REQUIRES UNIX BUILTIN SOURCES pwdmodule.c) # this is needed to find out the user's home dir if $HOME is not set
add_python_extension(resource REQUIRES UNIX SOURCES resource.c)
add_python_extension(spwd REQUIRES UNIX HAVE_GETSPNAM HAVE_GETSPENT SOURCES spwdmodule.c)
if(PY_VERSION VERSION_LESS "3.13")
add_python_extension(spwd REQUIRES UNIX HAVE_GETSPNAM HAVE_GETSPENT SOURCES spwdmodule.c)
endif()
add_python_extension(syslog REQUIRES UNIX SOURCES syslogmodule.c)
add_python_extension(termios REQUIRES UNIX SOURCES termios.c)

Expand All @@ -266,7 +298,9 @@ add_python_extension(_scproxy

# Linux-only extensions
add_python_extension(linuxaudiodev REQUIRES LINUX IS_PY2 NOT_COSMOPOLITAN SOURCES linuxaudiodev.c)
add_python_extension(ossaudiodev REQUIRES LINUX NOT_COSMOPOLITAN SOURCES ossaudiodev.c)
if(PY_VERSION VERSION_LESS "3.13")
add_python_extension(ossaudiodev REQUIRES LINUX NOT_COSMOPOLITAN SOURCES ossaudiodev.c)
endif()

# Python 3.8: UNIX-only extensions
if(PY_VERSION VERSION_GREATER_EQUAL "3.8")
Expand All @@ -278,11 +312,13 @@ if(PY_VERSION VERSION_GREATER_EQUAL "3.8")
endif()

# Windows-only extensions
add_python_extension(_msi
REQUIRES WIN32
SOURCES ${SRC_DIR}/PC/_msi.c
LIBRARIES cabinet.lib msi.lib rpcrt4.lib
)
if(PY_VERSION VERSION_LESS "3.13")
add_python_extension(_msi
REQUIRES WIN32
SOURCES ${SRC_DIR}/PC/_msi.c
LIBRARIES cabinet.lib msi.lib rpcrt4.lib
)
endif()
add_python_extension(msvcrt REQUIRES MSVC BUILTIN SOURCES ${SRC_DIR}/PC/msvcrtmodule.c)
add_python_extension(nt REQUIRES WIN32 ALWAYS_BUILTIN SOURCES posixmodule.c)
add_python_extension(_subprocess REQUIRES WIN32 IS_PY2 BUILTIN SOURCES ${SRC_DIR}/PC/_subprocess.c)
Expand Down
Loading
Loading