Skip to content

Commit 57ff216

Browse files
hugovksobolevn
andauthored
[3.12] gh-101100: Fix Sphinx warnings in Doc/library/weakref.rst (GH-109881) (#109884)
[3.12] gh-101100: Fix Sphinx warnings in `Doc/library/weakref.rst` (GH-109881). (cherry picked from commit 7c61a36) Co-authored-by: Nikita Sobolev <[email protected]>
1 parent d2a2e25 commit 57ff216

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

Doc/library/weakref.rst

+9-10
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ See :ref:`__slots__ documentation <slots>` for details.
111111

112112
Exceptions raised by the callback will be noted on the standard error output,
113113
but cannot be propagated; they are handled in exactly the same way as exceptions
114-
raised from an object's :meth:`__del__` method.
114+
raised from an object's :meth:`~object.__del__` method.
115115

116116
Weak references are :term:`hashable` if the *object* is hashable. They will
117117
maintain their hash value even after the *object* was deleted. If
@@ -221,8 +221,7 @@ than needed.
221221
Added support for ``|`` and ``|=`` operators, as specified in :pep:`584`.
222222

223223
:class:`WeakValueDictionary` objects have an additional method that has the
224-
same issues as the :meth:`keyrefs` method of :class:`WeakKeyDictionary`
225-
objects.
224+
same issues as the :meth:`WeakKeyDictionary.keyrefs` method.
226225

227226

228227
.. method:: WeakValueDictionary.valuerefs()
@@ -281,7 +280,7 @@ objects.
281280
Exceptions raised by finalizer callbacks during garbage collection
282281
will be shown on the standard error output, but cannot be
283282
propagated. They are handled in the same way as exceptions raised
284-
from an object's :meth:`__del__` method or a weak reference's
283+
from an object's :meth:`~object.__del__` method or a weak reference's
285284
callback.
286285

287286
When the program exits, each remaining live finalizer is called
@@ -523,18 +522,18 @@ is still alive. For instance
523522
obj dead or exiting
524523

525524

526-
Comparing finalizers with :meth:`__del__` methods
527-
-------------------------------------------------
525+
Comparing finalizers with :meth:`~object.__del__` methods
526+
---------------------------------------------------------
528527

529528
Suppose we want to create a class whose instances represent temporary
530529
directories. The directories should be deleted with their contents
531530
when the first of the following events occurs:
532531

533532
* the object is garbage collected,
534-
* the object's :meth:`remove` method is called, or
533+
* the object's :meth:`!remove` method is called, or
535534
* the program exits.
536535

537-
We might try to implement the class using a :meth:`__del__` method as
536+
We might try to implement the class using a :meth:`~object.__del__` method as
538537
follows::
539538

540539
class TempDir:
@@ -553,12 +552,12 @@ follows::
553552
def __del__(self):
554553
self.remove()
555554

556-
Starting with Python 3.4, :meth:`__del__` methods no longer prevent
555+
Starting with Python 3.4, :meth:`~object.__del__` methods no longer prevent
557556
reference cycles from being garbage collected, and module globals are
558557
no longer forced to :const:`None` during :term:`interpreter shutdown`.
559558
So this code should work without any issues on CPython.
560559

561-
However, handling of :meth:`__del__` methods is notoriously implementation
560+
However, handling of :meth:`~object.__del__` methods is notoriously implementation
562561
specific, since it depends on internal details of the interpreter's garbage
563562
collector implementation.
564563

Doc/tools/.nitignore

-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@ Doc/library/unittest.mock.rst
147147
Doc/library/unittest.rst
148148
Doc/library/urllib.parse.rst
149149
Doc/library/urllib.request.rst
150-
Doc/library/weakref.rst
151150
Doc/library/webbrowser.rst
152151
Doc/library/wsgiref.rst
153152
Doc/library/xdrlib.rst

0 commit comments

Comments
 (0)