From: Tomas R. Date: Mon, 17 Feb 2025 15:48:29 +0000 (+0100) Subject: gh-125756: Document Pickler.clear_memo() (GH-125762) X-Git-Tag: v3.14.0a6~383 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=25422561de40075bd10c37b182a0d60008809770;p=thirdparty%2FPython%2Fcpython.git gh-125756: Document Pickler.clear_memo() (GH-125762) --- diff --git a/Doc/library/pickle.rst b/Doc/library/pickle.rst index 71fe3743c596..66aa51ceb846 100644 --- a/Doc/library/pickle.rst +++ b/Doc/library/pickle.rst @@ -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)