From 0e27fe775ccbc89ad826cf7f008aa8cf3f408729 Mon Sep 17 00:00:00 2001 From: Sam Gross Date: Thu, 11 Apr 2024 13:49:52 -0400 Subject: [PATCH] gh-111506: Error if the limited API is used in free-threaded build (#117762) Issue a build time error if both `Py_LIMITED_API` and `Py_GIL_DISABLED` are defined. --- Include/Python.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Include/Python.h b/Include/Python.h index ca38a98d8c4eca0..bb771fb3aec980d 100644 --- a/Include/Python.h +++ b/Include/Python.h @@ -45,6 +45,11 @@ # 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 // Include Python header files #include "pyport.h"