From 6e5eb1331559452e23ce5b381b9c3cab011c8cb4 Mon Sep 17 00:00:00 2001 From: yihong0618 Date: Thu, 15 Jan 2026 14:40:33 +0800 Subject: [PATCH v1] Fix PL/Python build with Python 3.13/3.14 free-threaded builds The free-threaded build requires extension artifacts built specifically for the t-suffixed ABI (e.g. python3.13t). It also does not support the Limited C API / stable ABI, so py_limited_api must be disabled when Py_GIL_DISABLED is set. See CPython docs "Building Extensions for the Free-Threaded Build". Signed-off-by: yihong0618 --- src/pl/plpython/plpython.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/pl/plpython/plpython.h b/src/pl/plpython/plpython.h index d0745bb68af..16b8c905dfb 100644 --- a/src/pl/plpython/plpython.h +++ b/src/pl/plpython/plpython.h @@ -27,10 +27,14 @@ * Enable Python Limited API * * XXX currently not enabled on MSVC because of build failures + * XXX currently not enabled for python free-thread build */ #if !defined(_MSC_VER) +#include +#if !defined(Py_GIL_DISABLED) #define Py_LIMITED_API 0x03020000 #endif +#endif /* * Pull in Python headers via a wrapper header, to control the scope of -- 2.49.0