@@ -5,7 +5,7 @@ Discussions-To: Pending
55Status: Draft
66Type: Standards Track
77Requires: 683
8- Created: 16 -Jul-2025
8+ Created: 17 -Jul-2025
99Python-Version: 3.15
1010Post-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``.
160160Lastly, immortality is also faster than deferred reference counting
161161(:c:func: `PyUnstable_Object_EnableDeferredRefcount `), which is used for
162162mitigating 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
166166Deallocators Rely On the Interpreter State
167167------------------------------------------
168168
169169Another, 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 .
171171In 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
173173allocator is per-interpreter, so it is unsafe to try to release an object's
@@ -228,13 +228,13 @@ return ``SSTATE_INTERNED_IMMORTAL`` instead.
228228Changes 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
234234Immortalization 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
330330Once again, this should already be true for all extensions.
331331Since 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
543543have been made immortal and is now deleted. As such, the deferred memory bank
544544should 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
549549Before any destruction of immortal objects starts to happen,
550550deferred memory deletion needs to be enabled.
0 commit comments