@@ -56,6 +56,10 @@ interpreter.
5656      for jump targets and exception handlers. The ``-O `` command line
5757      option and the ``show_offsets `` argument were added.
5858
59+    .. versionchanged :: 3.14 
60+       The :option: `-P <dis --show-positions> ` command-line option
61+       and the ``show_positions `` argument were added.
62+ 
5963Example: Given the function :func: `!myfunc `::
6064
6165   def myfunc(alist): 
@@ -85,7 +89,7 @@ The :mod:`dis` module can be invoked as a script from the command line:
8589
8690.. code-block :: sh 
8791
88-    python -m dis [-h] [-C] [-O] [infile] 
92+    python -m dis [-h] [-C] [-O] [-P] [ infile] 
8993
9094
9195
@@ -103,6 +107,10 @@ The following options are accepted:
103107
104108   Show offsets of instructions.
105109
110+ .. cmdoption :: -P, --show-positions 
111+ 
112+    Show positions of instructions in the source code.
113+ 
106114If :file: `infile ` is specified, its disassembled code will be written to stdout.
107115Otherwise, disassembly is performed on compiled source code received from stdin.
108116
@@ -116,7 +124,8 @@ The bytecode analysis API allows pieces of Python code to be wrapped in a
116124code.
117125
118126.. class :: Bytecode(x, *, first_line=None, current_offset=None,\ 
119-                     show_caches=False, adaptive=False, show_offsets=False)
127+                     show_caches=False, adaptive=False, show_offsets=False,\
128+                     show_positions=False)
120129
121130   Analyse the bytecode corresponding to a function, generator, asynchronous
122131   generator, coroutine, method, string of source code, or a code object (as
@@ -144,6 +153,9 @@ code.
144153   If *show_offsets * is ``True ``, :meth: `.dis ` will include instruction
145154   offsets in the output.
146155
156+    If *show_positions * is ``True ``, :meth: `.dis ` will include instruction
157+    source code positions in the output.
158+ 
147159   .. classmethod :: from_traceback(tb, *, show_caches=False) 
148160
149161      Construct a :class: `Bytecode ` instance from the given traceback, setting
@@ -173,6 +185,12 @@ code.
173185   .. versionchanged :: 3.11 
174186      Added the *show_caches * and *adaptive * parameters.
175187
188+    .. versionchanged :: 3.13 
189+       Added the *show_offsets * parameter
190+ 
191+    .. versionchanged :: 3.14 
192+       Added the *show_positions * parameter.
193+ 
176194Example:
177195
178196.. doctest ::
@@ -226,7 +244,8 @@ operation is being performed, so the intermediate analysis object isn't useful:
226244      Added *file * parameter.
227245
228246
229- .. function :: dis(x=None, *, file=None, depth=None, show_caches=False, adaptive=False) 
247+ .. function :: dis(x=None, *, file=None, depth=None, show_caches=False,\ 
248+                   adaptive=False, show_offsets=False, show_positions=False)
230249
231250   Disassemble the *x * object.  *x * can denote either a module, a class, a
232251   method, a function, a generator, an asynchronous generator, a coroutine,
@@ -265,9 +284,14 @@ operation is being performed, so the intermediate analysis object isn't useful:
265284   .. versionchanged :: 3.11 
266285      Added the *show_caches * and *adaptive * parameters.
267286
287+    .. versionchanged :: 3.13 
288+       Added the *show_offsets * parameter.
289+ 
290+    .. versionchanged :: 3.14 
291+       Added the *show_positions * parameter.
268292
269- .. function :: distb(tb=None, *, file=None, show_caches=False, adaptive=False, 
270-                     show_offset=False)
293+ .. function :: distb(tb=None, *, file=None, show_caches=False, adaptive=False,\  
294+                     show_offset=False, show_positions=False )
271295
272296   Disassemble the top-of-stack function of a traceback, using the last
273297   traceback if none was passed.  The instruction causing the exception is
@@ -285,14 +309,19 @@ operation is being performed, so the intermediate analysis object isn't useful:
285309   .. versionchanged :: 3.13 
286310      Added the *show_offsets * parameter.
287311
312+    .. versionchanged :: 3.14 
313+       Added the *show_positions * parameter.
314+ 
288315.. function :: disassemble(code, lasti=-1, *, file=None, show_caches=False, adaptive=False) 
289-               disco(code, lasti=-1, *, file=None, show_caches=False, adaptive=False, 
290-               show_offsets=False) 
316+               disco(code, lasti=-1, *, file=None, show_caches=False, adaptive=False,\  
317+                      show_offsets=False, show_positions =False) 
291318
292319   Disassemble a code object, indicating the last instruction if *lasti * was
293320   provided.  The output is divided in the following columns:
294321
295-    #. the line number, for the first instruction of each line
322+    #. the source code location of the instruction. Complete location information
323+       is shown if *show_positions * is true. Otherwise (the default) only the
324+       line number is displayed.
296325   #. the current instruction, indicated as ``--> ``,
297326   #. a labelled instruction, indicated with ``>> ``,
298327   #. the address of the instruction,
@@ -315,6 +344,9 @@ operation is being performed, so the intermediate analysis object isn't useful:
315344   .. versionchanged :: 3.13 
316345      Added the *show_offsets * parameter.
317346
347+    .. versionchanged :: 3.14 
348+       Added the *show_positions * parameter.
349+ 
318350.. function :: get_instructions(x, *, first_line=None, show_caches=False, adaptive=False) 
319351
320352   Return an iterator over the instructions in the supplied function, method,
0 commit comments