Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f751a9e

Browse files
Issue #22845: Improved formatting of dis documentation.
1 parent 4900877 commit f751a9e

1 file changed

Lines changed: 24 additions & 23 deletions

File tree

Doc/library/dis.rst

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ object isn't useful:
133133
.. versionadded:: 3.2
134134

135135
.. versionchanged:: 3.4
136-
Added ``file`` parameter
136+
Added *file* parameter.
137137

138138

139139
.. function:: dis(x=None, *, file=None)
@@ -147,11 +147,11 @@ object isn't useful:
147147
disassembled. If no object is provided, this function disassembles the last
148148
traceback.
149149

150-
The disassembly is written as text to the supplied ``file`` argument if
150+
The disassembly is written as text to the supplied *file* argument if
151151
provided and to ``sys.stdout`` otherwise.
152152

153153
.. versionchanged:: 3.4
154-
Added ``file`` parameter
154+
Added *file* parameter.
155155

156156

157157
.. function:: distb(tb=None, *, file=None)
@@ -160,11 +160,11 @@ object isn't useful:
160160
traceback if none was passed. The instruction causing the exception is
161161
indicated.
162162

163-
The disassembly is written as text to the supplied ``file`` argument if
163+
The disassembly is written as text to the supplied *file* argument if
164164
provided and to ``sys.stdout`` otherwise.
165165

166166
.. versionchanged:: 3.4
167-
Added ``file`` parameter
167+
Added *file* parameter.
168168

169169

170170
.. function:: disassemble(code, lasti=-1, *, file=None)
@@ -184,11 +184,11 @@ object isn't useful:
184184
The parameter interpretation recognizes local and global variable names,
185185
constant values, branch targets, and compare operators.
186186

187-
The disassembly is written as text to the supplied ``file`` argument if
187+
The disassembly is written as text to the supplied *file* argument if
188188
provided and to ``sys.stdout`` otherwise.
189189

190190
.. versionchanged:: 3.4
191-
Added ``file`` parameter
191+
Added *file* parameter.
192192

193193

194194
.. function:: get_instructions(x, *, first_line=None)
@@ -502,7 +502,7 @@ the original TOS1.
502502

503503
Implements the expression statement for the interactive mode. TOS is removed
504504
from the stack and printed. In non-interactive mode, an expression statement is
505-
terminated with ``POP_STACK``.
505+
terminated with :opcode:`POP_TOP`.
506506

507507

508508
.. opcode:: BREAK_LOOP
@@ -513,7 +513,7 @@ the original TOS1.
513513
.. opcode:: CONTINUE_LOOP (target)
514514

515515
Continues a loop due to a :keyword:`continue` statement. *target* is the
516-
address to jump to (which should be a ``FOR_ITER`` instruction).
516+
address to jump to (which should be a :opcode:`FOR_ITER` instruction).
517517

518518

519519
.. opcode:: SET_ADD (i)
@@ -531,7 +531,8 @@ the original TOS1.
531531
Calls ``dict.setitem(TOS1[-i], TOS, TOS1)``. Used to implement dict
532532
comprehensions.
533533

534-
For all of the SET_ADD, LIST_APPEND and MAP_ADD instructions, while the
534+
For all of the :opcode:`SET_ADD`, :opcode:`LIST_APPEND` and :opcode:`MAP_ADD`
535+
instructions, while the
535536
added value or key/value pair is popped off, the container object remains on
536537
the stack so that it is available for further iterations of the loop.
537538

@@ -584,7 +585,7 @@ the stack so that it is available for further iterations of the loop.
584585
.. opcode:: LOAD_BUILD_CLASS
585586

586587
Pushes :func:`builtins.__build_class__` onto the stack. It is later called
587-
by ``CALL_FUNCTION`` to construct a class.
588+
by :opcode:`CALL_FUNCTION` to construct a class.
588589

589590

590591
.. opcode:: SETUP_WITH (delta)
@@ -615,7 +616,7 @@ the stack so that it is available for further iterations of the loop.
615616

616617
If the stack represents an exception, *and* the function call returns
617618
a 'true' value, this information is "zapped" and replaced with a single
618-
``WHY_SILENCED`` to prevent ``END_FINALLY`` from re-raising the exception.
619+
``WHY_SILENCED`` to prevent :opcode:`END_FINALLY` from re-raising the exception.
619620
(But non-local gotos will still be resumed.)
620621

621622
.. XXX explain the WHY stuff!
@@ -627,8 +628,8 @@ the more significant byte last.
627628
.. opcode:: STORE_NAME (namei)
628629

629630
Implements ``name = TOS``. *namei* is the index of *name* in the attribute
630-
:attr:`co_names` of the code object. The compiler tries to use ``STORE_FAST``
631-
or ``STORE_GLOBAL`` if possible.
631+
:attr:`co_names` of the code object. The compiler tries to use :opcode:`STORE_FAST`
632+
or :opcode:`STORE_GLOBAL` if possible.
632633

633634

634635
.. opcode:: DELETE_NAME (namei)
@@ -668,12 +669,12 @@ the more significant byte last.
668669

669670
.. opcode:: STORE_GLOBAL (namei)
670671

671-
Works as ``STORE_NAME``, but stores the name as a global.
672+
Works as :opcode:`STORE_NAME`, but stores the name as a global.
672673

673674

674675
.. opcode:: DELETE_GLOBAL (namei)
675676

676-
Works as ``DELETE_NAME``, but deletes a global name.
677+
Works as :opcode:`DELETE_NAME`, but deletes a global name.
677678

678679

679680
.. opcode:: LOAD_CONST (consti)
@@ -694,12 +695,12 @@ the more significant byte last.
694695

695696
.. opcode:: BUILD_LIST (count)
696697

697-
Works as ``BUILD_TUPLE``, but creates a list.
698+
Works as :opcode:`BUILD_TUPLE`, but creates a list.
698699

699700

700701
.. opcode:: BUILD_SET (count)
701702

702-
Works as ``BUILD_TUPLE``, but creates a set.
703+
Works as :opcode:`BUILD_TUPLE`, but creates a set.
703704

704705

705706
.. opcode:: BUILD_MAP (count)
@@ -724,15 +725,15 @@ the more significant byte last.
724725
Imports the module ``co_names[namei]``. TOS and TOS1 are popped and provide
725726
the *fromlist* and *level* arguments of :func:`__import__`. The module
726727
object is pushed onto the stack. The current namespace is not affected:
727-
for a proper import statement, a subsequent ``STORE_FAST`` instruction
728+
for a proper import statement, a subsequent :opcode:`STORE_FAST` instruction
728729
modifies the namespace.
729730

730731

731732
.. opcode:: IMPORT_FROM (namei)
732733

733734
Loads the attribute ``co_names[namei]`` from the module found in TOS. The
734735
resulting object is pushed onto the stack, to be subsequently stored by a
735-
``STORE_FAST`` instruction.
736+
:opcode:`STORE_FAST` instruction.
736737

737738

738739
.. opcode:: JUMP_FORWARD (delta)
@@ -911,21 +912,21 @@ the more significant byte last.
911912

912913
.. opcode:: CALL_FUNCTION_VAR (argc)
913914

914-
Calls a function. *argc* is interpreted as in ``CALL_FUNCTION``. The top element
915+
Calls a function. *argc* is interpreted as in :opcode:`CALL_FUNCTION`. The top element
915916
on the stack contains the variable argument list, followed by keyword and
916917
positional arguments.
917918

918919

919920
.. opcode:: CALL_FUNCTION_KW (argc)
920921

921-
Calls a function. *argc* is interpreted as in ``CALL_FUNCTION``. The top element
922+
Calls a function. *argc* is interpreted as in :opcode:`CALL_FUNCTION`. The top element
922923
on the stack contains the keyword arguments dictionary, followed by explicit
923924
keyword and positional arguments.
924925

925926

926927
.. opcode:: CALL_FUNCTION_VAR_KW (argc)
927928

928-
Calls a function. *argc* is interpreted as in ``CALL_FUNCTION``. The top
929+
Calls a function. *argc* is interpreted as in :opcode:`CALL_FUNCTION`. The top
929930
element on the stack contains the keyword arguments dictionary, followed by the
930931
variable-arguments tuple, followed by explicit keyword and positional arguments.
931932

0 commit comments

Comments
 (0)