From b18485e3ac15b5d5b7be8d7117fef9994b745bf8 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Thu, 20 Jun 2024 15:24:24 -0400 Subject: [PATCH] fix: properly mark the C extension as safe for free-threading. #1799 https://github.com/python/cpython/blob/main/Doc/howto/free-threading-extensions.rst#c-api-extension-support-for-free-threading --- .github/workflows/python-nightly.yml | 5 ----- coverage/ctracer/module.c | 4 ++++ 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/python-nightly.yml b/.github/workflows/python-nightly.yml index 72427def9..59a74b3c7 100644 --- a/.github/workflows/python-nightly.yml +++ b/.github/workflows/python-nightly.yml @@ -86,11 +86,6 @@ jobs: - name: "Check out the repo" uses: "actions/checkout@v4" - - name: "Set PYTHON_GIL" - if: "${{ matrix.nogil }}" - run: | - echo "PYTHON_GIL=0" >> $GITHUB_ENV - - name: "Install ${{ matrix.python-version }} with deadsnakes" uses: deadsnakes/action@6c8b9b82fe0b4344f4b98f2775fcc395df45e494 if: "!startsWith(matrix.python-version, 'pypy-')" diff --git a/coverage/ctracer/module.c b/coverage/ctracer/module.c index d564a8128..33b50e64f 100644 --- a/coverage/ctracer/module.c +++ b/coverage/ctracer/module.c @@ -31,6 +31,10 @@ PyInit_tracer(void) return NULL; } +#ifdef Py_GIL_DISABLED + PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED); +#endif + if (CTracer_intern_strings() < 0) { return NULL; }