]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.12] gh-109961: Docs: Fix incorrect rendering of `__replace__` in `copy.rst` (GH...
authorHugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Mon, 17 Mar 2025 12:58:14 +0000 (14:58 +0200)
committerGitHub <noreply@github.com>
Mon, 17 Mar 2025 12:58:14 +0000 (14:58 +0200)
(cherry picked from commit 0baf72696e79191241a2d5cfdfd7e6135115f7b2)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Doc/library/copy.rst
Doc/tools/.nitignore

index 63fe823f6339347b44fb9fd95dc084883e5c747e..7031826526b9811409ddd61cef9d0508d40be71e 100644 (file)
@@ -80,13 +80,22 @@ pickle functions from the :mod:`copyreg` module.
    single: __deepcopy__() (copy protocol)
 
 In order for a class to define its own copy implementation, it can define
-special methods :meth:`__copy__` and :meth:`__deepcopy__`.  The former is called
-to implement the shallow copy operation; no additional arguments are passed.
-The latter is called to implement the deep copy operation; it is passed one
-argument, the ``memo`` dictionary.  If the :meth:`__deepcopy__` implementation needs
-to make a deep copy of a component, it should call the :func:`deepcopy` function
-with the component as first argument and the memo dictionary as second argument.
-The memo dictionary should be treated as an opaque object.
+special methods :meth:`~object.__copy__` and :meth:`~object.__deepcopy__`.
+
+.. method:: object.__copy__(self)
+   :noindexentry:
+
+   Called to implement the shallow copy operation;
+   no additional arguments are passed.
+
+.. method:: object.__deepcopy__(self, memo)
+   :noindexentry:
+
+   Called to implement the deep copy operation; it is passed one
+   argument, the *memo* dictionary.  If the ``__deepcopy__`` implementation needs
+   to make a deep copy of a component, it should call the :func:`deepcopy` function
+   with the component as first argument and the *memo* dictionary as second argument.
+   The *memo* dictionary should be treated as an opaque object.
 
 
 .. seealso::
index 293cc7f38673114e871b0f30606959af63944252..6891a725ecb020bf9e02315b834286a7fb4f7f8b 100644 (file)
@@ -21,7 +21,6 @@ Doc/library/asyncio-policy.rst
 Doc/library/audioop.rst
 Doc/library/cgi.rst
 Doc/library/chunk.rst
-Doc/library/copy.rst
 Doc/library/decimal.rst
 Doc/library/email.charset.rst
 Doc/library/email.compat32-message.rst