mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
[3.14] Docs: Fix and improve the PyUnstable_Object_EnableDeferredRefcount documentation (GH-135323) (GH-136610)
Docs: Fix and improve the `PyUnstable_Object_EnableDeferredRefcount` documentation (GH-135323)
(cherry picked from commit 0d4fd10fba)
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
This commit is contained in:
parent
f50cd5bec7
commit
a1ed132a19
1 changed files with 7 additions and 5 deletions
|
|
@ -596,12 +596,13 @@ Object Protocol
|
||||||
if supported by the runtime. In the :term:`free-threaded <free threading>` build,
|
if supported by the runtime. In the :term:`free-threaded <free threading>` build,
|
||||||
this allows the interpreter to avoid reference count adjustments to *obj*,
|
this allows the interpreter to avoid reference count adjustments to *obj*,
|
||||||
which may improve multi-threaded performance. The tradeoff is
|
which may improve multi-threaded performance. The tradeoff is
|
||||||
that *obj* will only be deallocated by the tracing garbage collector.
|
that *obj* will only be deallocated by the tracing garbage collector, and
|
||||||
|
not when the interpreter no longer has any references to it.
|
||||||
|
|
||||||
This function returns ``1`` if deferred reference counting is enabled on *obj*
|
This function returns ``1`` if deferred reference counting is enabled on *obj*,
|
||||||
(including when it was enabled before the call),
|
|
||||||
and ``0`` if deferred reference counting is not supported or if the hint was
|
and ``0`` if deferred reference counting is not supported or if the hint was
|
||||||
ignored by the runtime. This function is thread-safe, and cannot fail.
|
ignored by the interpreter, such as when deferred reference counting is already
|
||||||
|
enabled on *obj*. This function is thread-safe, and cannot fail.
|
||||||
|
|
||||||
This function does nothing on builds with the :term:`GIL` enabled, which do
|
This function does nothing on builds with the :term:`GIL` enabled, which do
|
||||||
not support deferred reference counting. This also does nothing if *obj* is not
|
not support deferred reference counting. This also does nothing if *obj* is not
|
||||||
|
|
@ -609,7 +610,8 @@ Object Protocol
|
||||||
:c:func:`PyObject_GC_IsTracked`).
|
:c:func:`PyObject_GC_IsTracked`).
|
||||||
|
|
||||||
This function is intended to be used soon after *obj* is created,
|
This function is intended to be used soon after *obj* is created,
|
||||||
by the code that creates it.
|
by the code that creates it, such as in the object's :c:member:`~PyTypeObject.tp_new`
|
||||||
|
slot.
|
||||||
|
|
||||||
.. versionadded:: 3.14
|
.. versionadded:: 3.14
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue