File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -334,6 +334,13 @@ The :c:member:`~PyTypeObject.tp_traverse` handler must have the following type:
334334 The :c:member:`~PyTypeObject.tp_traverse` function can be called from any
335335 thread.
336336
337+ .. impl-detail::
338+
339+ Garbage collection is a "stop-the-world" operation:
340+ even in :term:`free threading` builds, only one thread state is
341+ :term:`attached <attached thread state>` when :c:member:`!tp_traverse`
342+ handlers run.
343+
337344 .. versionchanged:: 3.9
338345
339346 Heap-allocated types are expected to visit ``Py_TYPE(self)`` in
@@ -372,7 +379,8 @@ The following functions and macros are safe to use in a
372379* the *visit * function passed to ``tp_traverse ``
373380* :c:func: `Py_VISIT `
374381* :c:func: `Py_SIZE `
375- * :c:func: `Py_TYPE `
382+ * :c:func: `Py_TYPE `: if called from a :c:member: `!tp_traverse ` handler,
383+ :c:func: `!Py_TYPE `'s result will be valid for the duration of the handler call
376384* :c:func: `PyObject_VisitManagedDict `
377385* :c:func: `PyObject_TypeCheck `, :c:func: `PyType_IsSubtype `,
378386 :c:func: `PyType_HasFeature `
You can’t perform that action at this time.
0 commit comments