Skip to content

Commit f572b59

Browse files
committed
Add CLI docs for pickle
1 parent 4162bc1 commit f572b59

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

Doc/library/cmdline.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ The following modules have a command-line interface.
2626
* :ref:`json <json-commandline>`
2727
* :mod:`mimetypes`
2828
* :mod:`pdb`
29-
* :mod:`pickle`
29+
* :ref:`pickle <pickle-cli>`
3030
* :ref:`pickletools <pickletools-cli>`
3131
* :mod:`platform`
3232
* :mod:`poplib`

Doc/library/pickle.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,30 @@ The :mod:`pickle` module exports three classes, :class:`Pickler`,
511511
Release the underlying buffer exposed by the PickleBuffer object.
512512

513513

514+
.. _pickle-cli:
515+
516+
Command-line interface
517+
----------------------------------
518+
519+
The :mod:`pickle` module can be invoked as a script from the command line,
520+
it will display contents of the pickle files. However, when the pickle file
521+
that you want to examine comes from an untrusted source, ``-m pickletools``
522+
is a safer option because it does not execute pickle bytecode, see
523+
:ref:`pickletools-cli`.
524+
525+
.. code-block:: bash
526+
527+
python -m pickle [pickle_file ...]
528+
529+
The following options are accepted:
530+
531+
.. program:: pickle
532+
533+
.. option:: pickle_file
534+
535+
The pickle file(s).
536+
537+
514538
.. _pickle-picklable:
515539

516540
What can be pickled and unpickled?

0 commit comments

Comments
 (0)