Primary
pickle ⚬⃕ᵖʸ|Documentation|1st|20251021131651-00-⌔
pickle — Python object serialization — Python 3 documentation
pickle— Python object serializationSource code: Lib/pickle.py
The
picklemodule implements binary protocols for serializing and de-serializing a Python object structure. “Pickling” is the process whereby a Python object hierarchy is converted into a byte stream, and “unpickling” is the inverse operation, whereby a byte stream (from a binary file or bytes-like object) is converted back into an object hierarchy. Pickling (and unpickling) is alternatively known as “serialization”, “marshalling,” [1] or “flattening”; however, to avoid confusion, the terms used here are “pickling” and “unpickling”.Warning: The
picklemodule is not secure. Only unpickle data you trust.It is possible to construct malicious pickle data which will execute arbitrary code during unpickling. Never unpickle data that could have come from an untrusted source, or that could have been tampered with.
Consider signing data with
hmacif you need to ensure that it has not been tampered with.Safer serialization formats such as
jsonmay be more appropriate if you are processing untrusted data. See Comparison with json.Printed 2026-06-28.
(echo:: @ ᯤ)
Link to original
Secondary
• • •