File tree 4 files changed +30
-4
lines changed
Misc/NEWS.d/next/Documentation
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.
12
12
* :ref: `compileall <compileall-cli >`
13
13
* :mod: `cProfile `: see :ref: `profile <profile-cli >`
14
14
* :ref: `difflib <difflib-interface >`
15
- * :mod : `dis `
15
+ * :ref : `dis < dis-cli > `
16
16
* :mod: `doctest `
17
17
* :mod: `!encodings.rot_13 `
18
18
* :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
63
63
64
64
(The "2" is a line number).
65
65
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
+
66
92
Bytecode analysis
67
93
-----------------
68
94
Original file line number Diff line number Diff line change @@ -896,8 +896,7 @@ def dis(self):
896
896
return output .getvalue ()
897
897
898
898
899
- def _test ():
900
- """Simple test program to disassemble a file."""
899
+ def main ():
901
900
import argparse
902
901
903
902
parser = argparse .ArgumentParser ()
@@ -911,4 +910,4 @@ def _test():
911
910
dis (code , show_caches = args .show_caches )
912
911
913
912
if __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