While working on hynek/argon2-cffi-bindings#137, I noticed that the output of cffi-gen-src is different for a free-threaded and GIL-enabled interpreter.
Self-contained reproducer:
$ cat demo_build.py
from cffi import FFI
ffibuilder = FFI()
ffibuilder.cdef("int square(int n);")
ffibuilder.set_source("_demo", "static int square(int n) { return n * n; }")
$
$ python3.14 -m cffi.gen_src exec-python demo_build.py demo-gil.c
$ python3.14t -m cffi.gen_src exec-python demo_build.py demo-ft.c
$ diff -u demo-gil.c demo-ft.c
--- demo-gil.c 2026-07-28 14:57:58
+++ demo-ft.c 2026-07-28 14:58:20
@@ -1,3 +1,4 @@
+#define _CFFI_NO_LIMITED_API
#define _CFFI_
/* We try to define Py_LIMITED_API before including Python.h.
While working on hynek/argon2-cffi-bindings#137, I noticed that the output of
cffi-gen-srcis different for a free-threaded and GIL-enabled interpreter.Self-contained reproducer: