@@ -32,7 +32,7 @@ do one of the following:
3232 - on other systems, use the headers of free-threaded build of Python.
3333
3434``PyObject `` and ``PyVarObject `` opaqueness
35- =======================
35+ ===========================================
3636
3737Accessing any member of ``PyObject `` directly is now prohibited, like the non-GIL
3838stable ABI. For instance, prefer ``Py_TYPE() `` and ``Py_SET_TYPE() `` over ``ob_type ``,
@@ -48,7 +48,7 @@ Extension modules need to explicitly indicate that they support running with
4848the GIL disabled; otherwise importing the extension will raise a warning and
4949enable the GIL at runtime.
5050
51- Multi-phase and single-phase initialization is supported to indicate that an extension module
51+ Multi-phase and single-phase initialization is supported to indicate that an extension module
5252targeting the stable ABI supports running with the GIL disabled, though the former is preferred.
5353
5454Multi-Phase Initialization
@@ -72,7 +72,7 @@ you should guard the slot with a :c:data:`Py_GIL_DISABLED` check.
7272 {0, NULL}
7373 };
7474
75- Additionally, using :c:macro: ` PyABIInfo_VAR and :c:data:` Py_mod_abi ` is recommended so that an
75+ Additionally, using `` PyABIInfo_VAR `` and `` Py_mod_abi ` ` is recommended so that an
7676extension module loaded for an incompatible interpreter will trigger an exception, rather than
7777fail with a crash.
7878
@@ -119,25 +119,6 @@ Containers like :c:struct:`PyListObject`,
119119in the free-threaded build. For example, the :c:func: `PyList_Append ` will
120120lock the list before appending an item.
121121
122- .. _PyDict_Next :
123-
124- ``PyDict_Next ``
125- '''''''''''''''
126-
127- A notable exception is :c:func: `PyDict_Next `, which does not lock the
128- dictionary. You should use :c:macro: `Py_BEGIN_CRITICAL_SECTION ` to protect
129- the dictionary while iterating over it if the dictionary may be concurrently
130- modified::
131-
132- Py_BEGIN_CRITICAL_SECTION(dict);
133- PyObject *key, *value;
134- Py_ssize_t pos = 0;
135- while (PyDict_Next(dict, &pos, &key, &value)) {
136- ...
137- }
138- Py_END_CRITICAL_SECTION();
139-
140-
141122Borrowed References
142123===================
143124
@@ -190,26 +171,6 @@ Some of these functions were added in Python 3.13. You can use the
190171to provide implementations of these functions for older Python versions.
191172
192173
193- .. _free-threaded-memory-allocation :
194-
195- Memory Allocation APIs
196- ======================
197-
198- Python's memory management C API provides functions in three different
199- :ref: `allocation domains <allocator-domains >`: "raw", "mem", and "object".
200- For thread-safety, the free-threaded build requires that only Python objects
201- are allocated using the object domain, and that all Python objects are
202- allocated using that domain. This differs from the prior Python versions,
203- where this was only a best practice and not a hard requirement.
204-
205- .. note ::
206-
207- Search for uses of :c:func: `PyObject_Malloc ` in your
208- extension and check that the allocated memory is used for Python objects.
209- Use :c:func: `PyMem_Malloc ` to allocate buffers instead of
210- :c:func: `PyObject_Malloc `.
211-
212-
213174Thread State and GIL APIs
214175=========================
215176
@@ -405,8 +366,7 @@ If you use
405366your extension, a future version of ``setuptools `` will allow ``py_limited_api=True ``
406367to be set to allow targeting limited API when building with the free-threaded build.
407368
408- Other build tools will support this ABI as well:
409- `<https://packaging.python.org/en/latest/guides/tool-recommendations/#build-backends-for-extension-modules> `
369+ `Other build tools will support this ABI as well <https://packaging.python.org/en/latest/guides/tool-recommendations/#build-backends-for-extension-modules >`_.
410370
411371.. seealso ::
412372
0 commit comments