Skip to content

Commit 43b9356

Browse files
Move PyDict_Next strong ref note closer to free-threading section
1 parent 4237683 commit 43b9356

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

Doc/c-api/dict.rst

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -299,20 +299,18 @@ Dictionary Objects
299299
300300
On the :term:`free threaded <free threading>` build, this function can be used safely inside
301301
a critical section. However, the references returned for *pkey* and
302-
*pvalue* are :term:`borrowed <borrowed reference>` and only valid while the critical section is
303-
held. If you need to use these objects outside the critical section or when the critical section
302+
*pvalue* are :term:`borrowed <borrowed reference>` and only valid while the critical section
303+
is held. If you need to use these objects outside the critical section or when the critical section
304304
can be suspended, create :term:`strong reference <strong reference>` (for example, with
305305
:c:func:`Py_NewRef`).
306306
307-
.. code-block:: c
308-
309-
Py_BEGIN_CRITICAL_SECTION(self->dict);
310-
while (PyDict_Next(self->dict, &pos, &key, &value)) {
311-
...
312-
}
313-
Py_END_CRITICAL_SECTION();
314-
307+
.. code-block:: c
315308
309+
Py_BEGIN_CRITICAL_SECTION(self->dict);
310+
while (PyDict_Next(self->dict, &pos, &key, &value)) {
311+
...
312+
}
313+
Py_END_CRITICAL_SECTION();
316314
317315
.. c:function:: int PyDict_Merge(PyObject *a, PyObject *b, int override)
318316

0 commit comments

Comments
 (0)