@@ -14,29 +14,22 @@ to adapt C API extensions to support free threading.
1414Identifying the Free-Threaded Limited API Build in C
1515====================================================
1616
17- The CPython C API exposes the :c:macro: `!Py_LIMITED_API ` macro: in the free-threaded stable ABI
18- build it's defined to `` 1 ``, and in the regular build it's not defined .
17+ Define :c:macro: `!Py_TARGET_ABI3T ` to the lowest Python version your extension supports,
18+ either in the form of ` Py_PACK_VERSION(3.15) ` or its direct hex value (such as `` 0x30f0000 `` for 3.15) .
1919You can use it to enable code that only runs under the free-threaded build::
2020
2121 #ifdef Py_TARGET_ABI3T
2222 /* code that only runs in the free-threaded stable ABI build */
2323 #endif
2424
25- If you wish to build youe extension with both ``abi3 `` (Stable ABI with GIL) and ``abi3t `` (no-GIL stable ABI) tags,
26- do one of the following:
27-
28- - define both :c:macro: `!Py_LIMITED_API ` and :c:macro: `!Py_TARGET_ABI3T `, or
29- - define only :c:macro: `!Py_LIMITED_API ` and:
30-
31- - on Windows, define :c:macro: `!Py_GIL_DISABLED `;
32- - on other systems, use the headers of free-threaded build of Python.
33-
3425``PyObject `` and ``PyVarObject `` opaqueness
3526===========================================
3627
37- Accessing any member of ``PyObject `` directly is now prohibited, like the non-GIL
38- stable ABI. For instance, prefer ``Py_TYPE() `` and ``Py_SET_TYPE() `` over ``ob_type ``,
28+ Accessing any member of ``PyObject `` directly is now prohibited, unlike the GIL
29+ stable ABI, where accessing such members are merely discouraged.
30+ For instance, prefer ``Py_TYPE() `` and ``Py_SET_TYPE() `` over ``ob_type ``,
3931``Py_REFCNT ``, ``Py_IncRef() `` and ``Py_DecRef() `` over ``ob_refcnt ``, etc.
32+ Also, embedding :c:macro: `PyObject_HEAD ` within a struct is impossible.
4033
4134Similarly, members of ``PyVarObject `` are not visible. If you need any object of such type
4235to be passed as a ``PyObject `` parameter to any API function, cast it directly as ``PyObject ``.
@@ -105,7 +98,7 @@ Critical Sections
10598
10699.. _critical-sections :
107100
108- Replacements :
101+ Equivalent functions :
109102
110103+-------------------------------------------+---------------------------------------+
111104| Macro functions | C API functions |
0 commit comments