Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 1 addition & 11 deletions Doc/library/pickle.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,8 @@

The :mod:`pickle` module differs from :mod:`marshal` in several significant ways:

* The :mod:`pickle` module keeps track of the objects it has already serialized,
* * The :mod:`pickle` module keeps track of the objects it has already serialized,
so that later references to the same object won't be serialized again.

Check warning on line 60 in Doc/library/pickle.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

Bullet list ends without a blank line; unexpected unindent. [docutils]
:mod:`marshal` doesn't do this.

This has implications both for recursive objects and object sharing. Recursive
objects are objects that contain references to themselves. These are not
handled by marshal, and in fact, attempting to marshal recursive objects will
crash your Python interpreter. Object sharing happens when there are multiple
references to the same object in different places in the object hierarchy being
serialized. :mod:`pickle` stores such objects only once, and ensures that all
other references point to the master copy. Shared objects remain shared, which
can be very important for mutable objects.

* :mod:`marshal` cannot be used to serialize user-defined classes and their
instances. :mod:`pickle` can save and restore class instances transparently,
Expand Down
Loading