* :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`
(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
-----------------
return output.getvalue()
-def _test():
- """Simple test program to disassemble a file."""
+def main():
import argparse
parser = argparse.ArgumentParser()
dis(code, show_caches=args.show_caches)
if __name__ == "__main__":
- _test()
+ main()