From 876274b6dcd7aa32d560fc9bf67782634ff81a54 Mon Sep 17 00:00:00 2001 From: Nikita Sobolev Date: Thu, 28 Sep 2023 14:51:33 +0300 Subject: [PATCH] [3.12] gh-109961: Docs: Fix incorrect rendering of `__replace__` in `copy.rst` (GH-109968) (cherry picked from commit 0baf72696e79191241a2d5cfdfd7e6135115f7b2) Co-authored-by: Nikita Sobolev --- Doc/library/copy.rst | 23 ++++++++++++++++------- Doc/tools/.nitignore | 1 - 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/Doc/library/copy.rst b/Doc/library/copy.rst index 63fe823f633934..7031826526b981 100644 --- a/Doc/library/copy.rst +++ b/Doc/library/copy.rst @@ -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:: diff --git a/Doc/tools/.nitignore b/Doc/tools/.nitignore index e3eeafe8316e66..ee5cd713376dd9 100644 --- a/Doc/tools/.nitignore +++ b/Doc/tools/.nitignore @@ -22,7 +22,6 @@ Doc/library/asyncio-subprocess.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