Skip to content

Commit daac7b3

Browse files
committed
Document the show_jit parameter in the dis module
show_jit was added to dis.dis(), distb(), disassemble(), get_instructions() and the Bytecode class (gh-150478) but was never documented. Document it across those APIs with a versionchanged:: 3.16 note, and fix a pre-existing show_offset -> show_offsets typo in the distb signature. Also add a Misc/ACKS entry.
1 parent 9ad6ba0 commit daac7b3

2 files changed

Lines changed: 32 additions & 6 deletions

File tree

Doc/library/dis.rst

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ code.
139139

140140
.. class:: Bytecode(x, *, first_line=None, current_offset=None,\
141141
show_caches=False, adaptive=False, show_offsets=False,\
142-
show_positions=False)
142+
show_positions=False, show_jit=False)
143143

144144
Analyse the bytecode corresponding to a function, generator, asynchronous
145145
generator, coroutine, method, string of source code, or a code object (as
@@ -170,6 +170,9 @@ code.
170170
If *show_positions* is ``True``, :meth:`.dis` will include instruction
171171
source code positions in the output.
172172

173+
If *show_jit* is ``True``, :meth:`.dis` will show ``ENTER_EXECUTOR``
174+
instructions, which mark JIT entry points and are hidden by default.
175+
173176
.. classmethod:: from_traceback(tb, *, show_caches=False)
174177

175178
Construct a :class:`Bytecode` instance from the given traceback, setting
@@ -205,6 +208,9 @@ code.
205208
.. versionchanged:: 3.14
206209
Added the *show_positions* parameter.
207210

211+
.. versionchanged:: 3.16
212+
Added the *show_jit* parameter.
213+
208214
Example:
209215

210216
.. doctest::
@@ -259,7 +265,8 @@ operation is being performed, so the intermediate analysis object isn't useful:
259265

260266

261267
.. function:: dis(x=None, *, file=None, depth=None, show_caches=False,\
262-
adaptive=False, show_offsets=False, show_positions=False)
268+
adaptive=False, show_offsets=False, show_positions=False,\
269+
show_jit=False)
263270

264271
Disassemble the *x* object. *x* can denote either a module, a class, a
265272
method, a function, a generator, an asynchronous generator, a coroutine,
@@ -286,6 +293,9 @@ operation is being performed, so the intermediate analysis object isn't useful:
286293
If *adaptive* is ``True``, this function will display specialized bytecode
287294
that may be different from the original bytecode.
288295

296+
If *show_jit* is ``True``, this function will show ``ENTER_EXECUTOR``
297+
instructions, which mark JIT entry points and are hidden by default.
298+
289299
.. versionchanged:: 3.4
290300
Added *file* parameter.
291301

@@ -304,8 +314,11 @@ operation is being performed, so the intermediate analysis object isn't useful:
304314
.. versionchanged:: 3.14
305315
Added the *show_positions* parameter.
306316

317+
.. versionchanged:: 3.16
318+
Added the *show_jit* parameter.
319+
307320
.. function:: distb(tb=None, *, file=None, show_caches=False, adaptive=False,\
308-
show_offset=False, show_positions=False)
321+
show_offsets=False, show_positions=False, show_jit=False)
309322

310323
Disassemble the top-of-stack function of a traceback, using the last
311324
traceback if none was passed. The instruction causing the exception is
@@ -326,10 +339,14 @@ operation is being performed, so the intermediate analysis object isn't useful:
326339
.. versionchanged:: 3.14
327340
Added the *show_positions* parameter.
328341

342+
.. versionchanged:: 3.16
343+
Added the *show_jit* parameter.
344+
329345
.. function:: disassemble(code, lasti=-1, *, file=None, show_caches=False,\
330-
adaptive=False, show_offsets=False, show_positions=False)
346+
adaptive=False, show_offsets=False, show_positions=False,\
347+
show_jit=False)
331348
disco(code, lasti=-1, *, file=None, show_caches=False, adaptive=False,\
332-
show_offsets=False, show_positions=False)
349+
show_offsets=False, show_positions=False, show_jit=False)
333350
334351
Disassemble a code object, indicating the last instruction if *lasti* was
335352
provided. The output is divided in the following columns:
@@ -362,7 +379,10 @@ operation is being performed, so the intermediate analysis object isn't useful:
362379
.. versionchanged:: 3.14
363380
Added the *show_positions* parameter.
364381

365-
.. function:: get_instructions(x, *, first_line=None, show_caches=False, adaptive=False)
382+
.. versionchanged:: 3.16
383+
Added the *show_jit* parameter.
384+
385+
.. function:: get_instructions(x, *, first_line=None, show_caches=False, adaptive=False, show_jit=False)
366386

367387
Return an iterator over the instructions in the supplied function, method,
368388
source code string or code object.
@@ -377,6 +397,8 @@ operation is being performed, so the intermediate analysis object isn't useful:
377397

378398
The *adaptive* parameter works as it does in :func:`dis`.
379399

400+
The *show_jit* parameter works as it does in :func:`dis`.
401+
380402
.. versionadded:: 3.4
381403

382404
.. versionchanged:: 3.11
@@ -388,6 +410,9 @@ operation is being performed, so the intermediate analysis object isn't useful:
388410
field populated (regardless of the value of *show_caches*) and it no longer
389411
generates separate items for the cache entries.
390412

413+
.. versionchanged:: 3.16
414+
Added the *show_jit* parameter.
415+
391416
.. function:: findlinestarts(code)
392417

393418
This generator function uses the :meth:`~codeobject.co_lines` method

Misc/ACKS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,7 @@ Erik Demaine
447447
Jeroen Demeyer
448448
Martin Dengler
449449
John Dennis
450+
Shardul Deshpande
450451
L. Peter Deutsch
451452
Roger Dev
452453
Philippe Devalkeneer

0 commit comments

Comments
 (0)