https://github.com/python/cpython/commit/3983fcad95dfa8da226ed3d995e88d8af87d63d2 commit: 3983fcad95dfa8da226ed3d995e88d8af87d63d2 branch: 3.12 author: Hugo van Kemenade <1324225+hug...@users.noreply.github.com> committer: hugovk <1324225+hug...@users.noreply.github.com> date: 2025-03-17T14:58:14+02:00 summary:
[3.12] gh-109961: Docs: Fix incorrect rendering of `__replace__` in `copy.rst` (GH-109968) (#130909) (cherry picked from commit 0baf72696e79191241a2d5cfdfd7e6135115f7b2) Co-authored-by: Nikita Sobolev <m...@sobolevn.me> files: M Doc/library/copy.rst M Doc/tools/.nitignore 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 293cc7f3867311..6891a725ecb020 100644 --- a/Doc/tools/.nitignore +++ b/Doc/tools/.nitignore @@ -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 _______________________________________________ Python-checkins mailing list -- python-checkins@python.org To unsubscribe send an email to python-checkins-le...@python.org https://mail.python.org/mailman3/lists/python-checkins.python.org/ Member address: arch...@mail-archive.com