File tree Expand file tree Collapse file tree 4 files changed +30
-4
lines changed
Misc/NEWS.d/next/Documentation Expand file tree Collapse file tree 4 files changed +30
-4
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ The following modules have a command-line interface.
1212* :ref: `compileall <compileall-cli >`
1313* :mod: `cProfile `: see :ref: `profile <profile-cli >`
1414* :ref: `difflib <difflib-interface >`
15- * :mod : `dis `
15+ * :ref : `dis < dis-cli > `
1616* :mod: `doctest `
1717* :mod: `!encodings.rot_13 `
1818* :mod: `ensurepip `
Original file line number Diff line number Diff line change @@ -63,6 +63,32 @@ the following command can be used to display the disassembly of
6363
6464(The "2" is a line number).
6565
66+ .. _dis-cli :
67+
68+ Command-line interface
69+ ----------------------
70+
71+ The :mod: `dis ` module can be invoked as a script from the command line:
72+
73+ .. code-block :: sh
74+
75+ python -m dis [-h] [-C] [infile]
76+
77+ The following options are accepted:
78+
79+ .. program :: dis
80+
81+ .. cmdoption :: -h, --help
82+
83+ Display usage and exit.
84+
85+ .. cmdoption :: -C, --show-caches
86+
87+ Show inline caches.
88+
89+ If :file: `infile ` is specified, its disassembled code will be written to stdout.
90+ Otherwise, disassembly is performed on compiled source code recieved from stdin.
91+
6692Bytecode analysis
6793-----------------
6894
Original file line number Diff line number Diff line change @@ -896,8 +896,7 @@ def dis(self):
896896 return output .getvalue ()
897897
898898
899- def _test ():
900- """Simple test program to disassemble a file."""
899+ def main ():
901900 import argparse
902901
903902 parser = argparse .ArgumentParser ()
@@ -911,4 +910,4 @@ def _test():
911910 dis (code , show_caches = args .show_caches )
912911
913912if __name__ == "__main__" :
914- _test ()
913+ main ()
Original file line number Diff line number Diff line change 1+ :mod: `dis ` module command-line interface is now mentioned in documentation.
You can’t perform that action at this time.
0 commit comments