From 45b514fb598427b13c5d883ff4d257bae5e6b55f Mon Sep 17 00:00:00 2001 From: kj <28750310+Fidget-Spinner@users.noreply.github.com> Date: Tue, 10 Nov 2020 23:51:37 +0800 Subject: [PATCH 1/2] Grammar fixes in glossary references --- Doc/glossary.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Doc/glossary.rst b/Doc/glossary.rst index b410585ca818c1..0661c8283290ce 100644 --- a/Doc/glossary.rst +++ b/Doc/glossary.rst @@ -159,14 +159,14 @@ Glossary :class:`str` objects. borrowed reference - In the Python's C API, a borrowed reference is a reference to an object. + In Python's C API, a borrowed reference is a reference to an object. It does not modify the object reference count. It becomes a dangling pointer if the object is destroyed. For example, a garbage collection can remove the last :term:`strong reference` to the object and so destroy it. Calling :c:func:`Py_INCREF` on the :term:`borrowed reference` is recommended to convert it to a :term:`strong reference` in-place, except - if the object cannot be destroyed before the last usage of the borrowed + when the object cannot be destroyed before the last usage of the borrowed reference. The :c:func:`Py_NewRef` function can be used to create a new :term:`strong reference`. @@ -1113,9 +1113,9 @@ Glossary as :keyword:`if`, :keyword:`while` or :keyword:`for`. strong reference - In the Python's C API, a strong reference is a reference to an object - which increments object reference count when it is created and - decrements the object reference count when it is deleted. + In Python's C API, a strong reference is a reference to an object + which increments the object's reference count when it is created and + decrements the object's reference count when it is deleted. The :c:func:`Py_NewRef` function can be used to create a strong reference to an object. Usually, the :c:func:`Py_DECREF` function must be called on From 4ccc5b5008038fd8faf9c410086661a143ef0313 Mon Sep 17 00:00:00 2001 From: kj <28750310+Fidget-Spinner@users.noreply.github.com> Date: Wed, 11 Nov 2020 07:18:19 +0800 Subject: [PATCH 2/2] update weakref.rst too --- Doc/c-api/weakref.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/c-api/weakref.rst b/Doc/c-api/weakref.rst index fb6628a1bbf022..9205ca620a6ad4 100644 --- a/Doc/c-api/weakref.rst +++ b/Doc/c-api/weakref.rst @@ -59,7 +59,7 @@ as much as it can. This function returns a :term:`borrowed reference` to the referenced object. This means that you should always call :c:func:`Py_INCREF` on the object - except it cannot be destroyed before the last usage of the borrowed + except when it cannot be destroyed before the last usage of the borrowed reference.