]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-125756: Document Pickler.clear_memo() (GH-125762)
authorTomas R. <tomas.roun8@gmail.com>
Mon, 17 Feb 2025 15:48:29 +0000 (16:48 +0100)
committerGitHub <noreply@github.com>
Mon, 17 Feb 2025 15:48:29 +0000 (17:48 +0200)
Doc/library/pickle.rst

index 71fe3743c5968d306a3443084a2592436c3aabae..66aa51ceb84683aeafc29ca5acd5b54e5a93958f 100644 (file)
@@ -401,6 +401,15 @@ The :mod:`pickle` module exports three classes, :class:`Pickler`,
 
       Use :func:`pickletools.optimize` if you need more compact pickles.
 
+   .. method:: clear_memo()
+
+      Clears the pickler's "memo".
+
+      The memo is the data structure that remembers which objects the
+      pickler has already seen, so that shared or recursive objects
+      are pickled by reference and not by value.  This method is
+      useful when re-using picklers.
+
 
 .. class:: Unpickler(file, *, fix_imports=True, encoding="ASCII", errors="strict", buffers=None)