Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita1ed132

Browse files
[3.14] Docs: Fix and improve thePyUnstable_Object_EnableDeferredRefcount documentation (GH-135323) (GH-136610)
Docs: Fix and improve the `PyUnstable_Object_EnableDeferredRefcount` documentation (GH-135323)(cherry picked from commit0d4fd10)Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
1 parentf50cd5b commita1ed132

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

‎Doc/c-api/object.rst

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -596,20 +596,22 @@ Object Protocol
596596
if supported by the runtime. In the:term:`free-threaded <free threading>` build,
597597
this allows the interpreter to avoid reference count adjustments to *obj*,
598598
which may improve multi-threaded performance. The tradeoff is
599-
that *obj* will only be deallocated by the tracing garbage collector.
599+
that *obj* will only be deallocated by the tracing garbage collector, and
600+
not when the interpreter no longer has any references to it.
600601
601-
This function returns ``1`` if deferred reference counting is enabled on *obj*
602-
(including when it was enabled before the call),
602+
This function returns ``1`` if deferred reference counting is enabled on *obj*,
603603
and ``0`` if deferred reference counting is not supported or if the hint was
604-
ignored by the runtime. This function is thread-safe, and cannot fail.
604+
ignored by the interpreter, such as when deferred reference counting is already
605+
enabled on *obj*. This function is thread-safe, and cannot fail.
605606
606607
This function does nothing on builds with the:term:`GIL` enabled, which do
607608
not support deferred reference counting. This also does nothing if *obj* is not
608609
an object tracked by the garbage collector (see:func:`gc.is_tracked` and
609610
:c:func:`PyObject_GC_IsTracked`).
610611
611612
This function is intended to be used soon after *obj* is created,
612-
by the code that creates it.
613+
by the code that creates it, such as in the object's :c:member:`~PyTypeObject.tp_new`
614+
slot.
613615
614616
.. versionadded:: 3.14
615617

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp