Skip to content

Commit 3843f9c

Browse files
Apply suggestions from code review
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
1 parent 9b675af commit 3843f9c

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

peps/pep-0797.rst

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Discussions-To: Pending
55
Status: Draft
66
Type: Standards Track
77
Requires: 683
8-
Created: 16-Jul-2025
8+
Created: 17-Jul-2025
99
Python-Version: 3.15
1010
Post-History: `01-Jul-2025 <https://discuss.python.org/t/97306>`__
1111

@@ -160,14 +160,14 @@ on some common objects, such as ``None``, ``True``, or ``False``.
160160
Lastly, immortality is also faster than deferred reference counting
161161
(:c:func:`PyUnstable_Object_EnableDeferredRefcount`), which is used for
162162
mitigating reference count contention on some objects on the free-threaded build.
163-
It would be nice to allow users (likely large C API wrappers) to take advantage
164-
of that speedup.
163+
It would be nice to allow users, for example C API binding generators, to take advantage
164+
of this speedup.
165165

166166
Deallocators Rely On the Interpreter State
167167
------------------------------------------
168168

169169
Another, less intuitive, danger of reference counting is that when the
170-
object's reference count reaches zero, it immediately tries to get freed.
170+
object's reference count reaches zero, it immediately tries to deallocate itself.
171171
In doing so, an object will release its memory back to CPython's object allocator
172172
(typically via :c:func:`PyObject_GC_Del` or :c:func:`PyObject_Free`). This
173173
allocator is per-interpreter, so it is unsafe to try to release an object's
@@ -228,13 +228,13 @@ return ``SSTATE_INTERNED_IMMORTAL`` instead.
228228
Changes to Object Finalization
229229
******************************
230230

231-
The C API function, :c:func:`PyObject_CallFinalizer`, must be able to
232-
de-duplicate calls to immortal objects, even if they're non-GC types.
231+
The :c:func:`PyObject_CallFinalizer` function must be able to
232+
de-duplicate calls to finalize immortal objects, even if they're non-GC types.
233233

234234
Immortalization APIs
235235
********************
236236

237-
This PEP introduces two new semi-public APIs for making an object immortal:
237+
This PEP introduces two new APIs for making an object immortal:
238238
:c:func:`PyUnstable_Immortalize` and :func:`sys._immortalize`.
239239

240240
.. c:function:: int PyUnstable_Immortalize(PyObject *obj)
@@ -324,8 +324,8 @@ that reference counts are unstable:
324324

325325
.. _brought up: https://discuss.python.org/t/72006
326326

327-
Destructors Must Use ``tp_finalize``
328-
------------------------------------
327+
Destructors Must Use :c:member:`~PyTypeObject.tp_finalize`
328+
----------------------------------------------------------
329329

330330
Once again, this should already be true for all extensions.
331331
Since Python 3.4 (:pep:`442`), :c:member:`~PyTypeObject.tp_finalize` alongside
@@ -543,8 +543,8 @@ to modify the reference count of any object visible to a user, as it could
543543
have been made immortal and is now deleted. As such, the deferred memory bank
544544
should be cleared at the very end of an interpreter's life.
545545

546-
Preventing Reference Cycle UAFs
547-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
546+
Preventing Reference Cycle Use After Frees
547+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
548548

549549
Before any destruction of immortal objects starts to happen,
550550
deferred memory deletion needs to be enabled.

0 commit comments

Comments
 (0)