From 5f54ac7850856c3af4e0fdbd55f06faabcfe2881 Mon Sep 17 00:00:00 2001 From: Sam Gross Date: Thu, 11 Apr 2024 16:13:49 +0000 Subject: [PATCH 1/2] gh-111506: Error if the limited API is used in free-threaded build Issue a build time error if both `Py_LIMITED_API` and `Py_GIL_DISABLED` are defined. --- Include/Python.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Include/Python.h b/Include/Python.h index ca38a98d8c4eca..4f09b27adfe3da 100644 --- a/Include/Python.h +++ b/Include/Python.h @@ -45,6 +45,9 @@ # endif #endif +#if defined(Py_LIMITED_API) && defined(Py_GIL_DISABLED) +# error "The limited API is not currently supported in the free-threaded build" +#endif // Include Python header files #include "pyport.h" From 9df0a119f8ae65540f48376e0249f80205a5558f Mon Sep 17 00:00:00 2001 From: Sam Gross Date: Thu, 11 Apr 2024 16:31:06 +0000 Subject: [PATCH 2/2] Add reference to GitHub issue number --- Include/Python.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Include/Python.h b/Include/Python.h index 4f09b27adfe3da..bb771fb3aec980 100644 --- a/Include/Python.h +++ b/Include/Python.h @@ -45,6 +45,8 @@ # endif #endif +// gh-111506: The free-threaded build is not compatible with the limited API +// or the stable ABI. #if defined(Py_LIMITED_API) && defined(Py_GIL_DISABLED) # error "The limited API is not currently supported in the free-threaded build" #endif