Skip to content

Commit

Permalink
bpo-42294: Grammar fixes in doc glossary strong/weak refs (GH-23227)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fidget-Spinner authored Nov 10, 2020
1 parent 7e5ef0a commit 78ba7c6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Doc/c-api/weakref.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
10 changes: 5 additions & 5 deletions Doc/glossary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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`.

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 78ba7c6

Please sign in to comment.