diff options
author | Radislav Chugunov <52372310+chgnrdv@users.noreply.github.com> | 2023-10-10 22:31:28 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-10 22:31:28 (GMT) |
commit | 0d805b998ded854840f029b7f0c9a02eb3efa251 (patch) | |
tree | 9ab1efedf06694d2f16f504d7f50952acc602d25 /Doc | |
parent | 732532b0af9d1b5c7ae4932526c8d20d86c15507 (diff) | |
download | cpython-0d805b998ded854840f029b7f0c9a02eb3efa251.zip cpython-0d805b998ded854840f029b7f0c9a02eb3efa251.tar.gz cpython-0d805b998ded854840f029b7f0c9a02eb3efa251.tar.bz2 |
gh-108826: Document `dis` module CLI and rename `_test` function to `main` (#108827)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/cmdline.rst | 2 | ||||
-rw-r--r-- | Doc/library/dis.rst | 26 |
2 files changed, 27 insertions, 1 deletions
diff --git a/Doc/library/cmdline.rst b/Doc/library/cmdline.rst index 4a295e0..b2379be 100644 --- a/Doc/library/cmdline.rst +++ b/Doc/library/cmdline.rst @@ -12,7 +12,7 @@ The following modules have a command-line interface. * :ref:`compileall <compileall-cli>` * :mod:`cProfile`: see :ref:`profile <profile-cli>` * :ref:`difflib <difflib-interface>` -* :mod:`dis` +* :ref:`dis <dis-cli>` * :mod:`doctest` * :mod:`!encodings.rot_13` * :mod:`ensurepip` diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst index b835f1e..1f773b7 100644 --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -63,6 +63,32 @@ the following command can be used to display the disassembly of (The "2" is a line number). +.. _dis-cli: + +Command-line interface +---------------------- + +The :mod:`dis` module can be invoked as a script from the command line: + +.. code-block:: sh + + python -m dis [-h] [-C] [infile] + +The following options are accepted: + +.. program:: dis + +.. cmdoption:: -h, --help + + Display usage and exit. + +.. cmdoption:: -C, --show-caches + + Show inline caches. + +If :file:`infile` is specified, its disassembled code will be written to stdout. +Otherwise, disassembly is performed on compiled source code recieved from stdin. + Bytecode analysis ----------------- |