Skip to content

Commit 3983fca

Browse files
hugovksobolevn
andauthored
[3.12] gh-109961: Docs: Fix incorrect rendering of __replace__ in copy.rst (GH-109968) (#130909)
(cherry picked from commit 0baf726) Co-authored-by: Nikita Sobolev <[email protected]>
1 parent 6e7432f commit 3983fca

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

Doc/library/copy.rst

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,22 @@ pickle functions from the :mod:`copyreg` module.
8080
single: __deepcopy__() (copy protocol)
8181

8282
In order for a class to define its own copy implementation, it can define
83-
special methods :meth:`__copy__` and :meth:`__deepcopy__`. The former is called
84-
to implement the shallow copy operation; no additional arguments are passed.
85-
The latter is called to implement the deep copy operation; it is passed one
86-
argument, the ``memo`` dictionary. If the :meth:`__deepcopy__` implementation needs
87-
to make a deep copy of a component, it should call the :func:`deepcopy` function
88-
with the component as first argument and the memo dictionary as second argument.
89-
The memo dictionary should be treated as an opaque object.
83+
special methods :meth:`~object.__copy__` and :meth:`~object.__deepcopy__`.
84+
85+
.. method:: object.__copy__(self)
86+
:noindexentry:
87+
88+
Called to implement the shallow copy operation;
89+
no additional arguments are passed.
90+
91+
.. method:: object.__deepcopy__(self, memo)
92+
:noindexentry:
93+
94+
Called to implement the deep copy operation; it is passed one
95+
argument, the *memo* dictionary. If the ``__deepcopy__`` implementation needs
96+
to make a deep copy of a component, it should call the :func:`deepcopy` function
97+
with the component as first argument and the *memo* dictionary as second argument.
98+
The *memo* dictionary should be treated as an opaque object.
9099

91100

92101
.. seealso::

Doc/tools/.nitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ Doc/library/asyncio-policy.rst
2121
Doc/library/audioop.rst
2222
Doc/library/cgi.rst
2323
Doc/library/chunk.rst
24-
Doc/library/copy.rst
2524
Doc/library/decimal.rst
2625
Doc/library/email.charset.rst
2726
Doc/library/email.compat32-message.rst

0 commit comments

Comments
 (0)