From 203a9141ca19b15a5d190169fd05b0de904e95c3 Mon Sep 17 00:00:00 2001 From: Tomas Roun Date: Mon, 21 Oct 2024 00:24:03 +0200 Subject: [PATCH 1/2] Document Pickler.clear_memo --- Doc/library/pickle.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Doc/library/pickle.rst b/Doc/library/pickle.rst index 71fe3743c5968d..ec79f5da062ff5 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(obj) + + 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) From 3e67e89c051c4c04812a63026fc00856df3c5d1f Mon Sep 17 00:00:00 2001 From: "Tomas R." Date: Mon, 21 Oct 2024 11:13:30 +0200 Subject: [PATCH 2/2] Update Doc/library/pickle.rst Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> --- Doc/library/pickle.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/pickle.rst b/Doc/library/pickle.rst index ec79f5da062ff5..66aa51ceb84683 100644 --- a/Doc/library/pickle.rst +++ b/Doc/library/pickle.rst @@ -401,7 +401,7 @@ The :mod:`pickle` module exports three classes, :class:`Pickler`, Use :func:`pickletools.optimize` if you need more compact pickles. - .. method:: clear_memo(obj) + .. method:: clear_memo() Clears the pickler's "memo".