From b749782cf5253bc1dccb8cdaef32d26c2e96c6ac Mon Sep 17 00:00:00 2001 From: Lysandros Nikolaou Date: Wed, 28 May 2025 13:30:12 +0200 Subject: [PATCH] Mark extensions as free-threading-compatible and build wheels --- .github/workflows/ci.yml | 2 ++ CHANGELOG.rst | 2 ++ src/isal/_isalmodule.c | 5 +++++ src/isal/igzip_libmodule.c | 5 +++++ src/isal/isal_zlibmodule.c | 4 ++++ 5 files changed, 18 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b886a730..104b11db 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -59,6 +59,7 @@ jobs: - "3.11" - "3.12" - "3.13" + - "3.13t" - "pypy-3.9" - "pypy-3.10" os: ["ubuntu-latest"] @@ -215,6 +216,7 @@ jobs: run: cibuildwheel --output-dir dist env: CIBW_SKIP: "*-win32 *-manylinux_i686 cp38-macosx_*arm64 cp39-macosx_*arm64" # Skip 32 bit and problematic mac builds. + CIBW_ENABLE: "cpython-freethreading" CIBW_ARCHS_LINUX: ${{ matrix.cibw_archs_linux }} CIBW_BEFORE_ALL_LINUX: ${{ matrix.cibw_before_all_linux }} # Fully test the build wheels again. diff --git a/CHANGELOG.rst b/CHANGELOG.rst index c49acba7..c20a0a5f 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -16,6 +16,8 @@ version 1.8.0-dev + Include test packages in the source distribution, so source distribution installations can be verified. + Fix an issue where some tests failed because they ignored PYTHONPATH. ++ Enable support for free-threading and build free-threaded wheels for + CPython 3.13. version 1.7.2 ----------------- diff --git a/src/isal/_isalmodule.c b/src/isal/_isalmodule.c index a429d3a7..55f43917 100644 --- a/src/isal/_isalmodule.c +++ b/src/isal/_isalmodule.c @@ -31,6 +31,11 @@ PyInit__isal(void) if (m == NULL) { return NULL; } + +#ifdef Py_GIL_DISABLED + PyUnstable_Module_SetGIL(m, Py_MOD_GIL_NOT_USED); +#endif + PyModule_AddIntMacro(m, ISAL_MAJOR_VERSION); PyModule_AddIntMacro(m, ISAL_MINOR_VERSION); PyModule_AddIntMacro(m, ISAL_PATCH_VERSION); diff --git a/src/isal/igzip_libmodule.c b/src/isal/igzip_libmodule.c index de94ab01..d498145f 100644 --- a/src/isal/igzip_libmodule.c +++ b/src/isal/igzip_libmodule.c @@ -617,6 +617,11 @@ PyInit_igzip_lib(void) if (m == NULL) return NULL; +#ifdef Py_GIL_DISABLED + PyUnstable_Module_SetGIL(m, Py_MOD_GIL_NOT_USED); +#endif + + IsalError = PyErr_NewException("igzip_lib.IsalError", NULL, NULL); if (IsalError == NULL) { return NULL; diff --git a/src/isal/isal_zlibmodule.c b/src/isal/isal_zlibmodule.c index 67547be9..3a280ec8 100644 --- a/src/isal/isal_zlibmodule.c +++ b/src/isal/isal_zlibmodule.c @@ -2183,6 +2183,10 @@ PyInit_isal_zlib(void) return NULL; } +#ifdef Py_GIL_DISABLED + PyUnstable_Module_SetGIL(m, Py_MOD_GIL_NOT_USED); +#endif + PyObject *igzip_lib_module = PyImport_ImportModule("isal.igzip_lib"); if (igzip_lib_module == NULL) { return NULL;