Skip to content

Commit 295832f

Browse files
committed
fix API doc
1 parent 341d31f commit 295832f

1 file changed

Lines changed: 16 additions & 16 deletions

File tree

doc/api.rst

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ Functions
3131
Dump a bytecode to the standard output. :class:`ConcreteBytecode`,
3232
:class:`Bytecode` and :class:`ControlFlowGraph` are accepted for *bytecode*.
3333

34-
If *lineno*, show also line numbers and instruction index/offset.
34+
If *lineno* is true, show also line numbers and instruction index/offset.
3535

3636
This function is written for debug purpose.
3737

3838

39-
Instruction classess
40-
====================
39+
Instruction classes
40+
===================
4141

4242
BaseInstr
4343
---------
@@ -47,7 +47,7 @@ BaseInstr
4747
Base class of instruction classes.
4848

4949
To replace the operation name and the argument, the :meth:`set` method must
50-
be used instead of than modifying the :attr:`name` attribute and then the
50+
be used instead of modifying the :attr:`name` attribute and then the
5151
:attr:`arg` attribute. Otherwise, an exception is be raised if the previous
5252
operation requires an argument and the new operation has no argument (or the
5353
opposite).
@@ -66,11 +66,13 @@ BaseInstr
6666

6767
.. attribute:: name
6868

69-
Operation name (``str``).
69+
Operation name (``str``). Setting the name updates the :attr:`opcode`
70+
attibute.
7071

7172
.. attribute:: opcode
7273

73-
Operation code (``int``).
74+
Operation code (``int``). Setting the operation code updates the
75+
:attr:`name` attribute.
7476

7577
.. versionchanged:: 0.3
7678
The ``op`` attribute was renamed to :attr:`opcode`.
@@ -127,9 +129,7 @@ BaseInstr
127129
.. method:: set(name: str, arg=UNSET)
128130

129131
Modify the instruction in-place: replace :attr:`name` and :attr:`arg`
130-
attributes.
131-
132-
The :attr:`lineno` attribute is unchanged.
132+
attributes, and update the :attr:`opcode` attribute.
133133

134134
.. versionchanged:: 0.3
135135
The *lineno* parameter has been removed.
@@ -145,7 +145,7 @@ Instr
145145
The type of the *arg* parameter (and the :attr:`arg` attribute) depends on
146146
the operation:
147147

148-
* If the operation has a jump argument (:meth:`has_jump`, ex:
148+
* If the operation has a jump argument (:meth:`~BaseInstr.has_jump`, ex:
149149
``JUMP_ABSOLUTE``): *arg* must be a :class:`Label` (if the instruction is
150150
used in :class:`Bytecode`) or a :class:`BasicBlock` (used in
151151
:class:`ControlFlowGraph`).
@@ -155,8 +155,8 @@ Instr
155155
variable name, type ``str``.
156156
* If the operation has a constant argument (``LOAD_CONST``): *arg* must not
157157
be a :class:`Label` or :class:`BasicBlock` instance.
158-
* If the operation has a compare argument (``'COMPARE_OP'``):
159-
*arg* must a :class:`Compare` enum.
158+
* If the operation has a compare argument (``COMPARE_OP``):
159+
*arg* must be a :class:`Compare` enum.
160160
* If the operation has no argument (ex: ``DUP_TOP``), *arg* must not be set.
161161
* Otherwise (the operation has an argument, ex: ``CALL_FUNCTION``), *arg*
162162
must be an integer (``int``) in the range ``0``..\ ``2,147,483,647``.
@@ -182,7 +182,7 @@ ConcreteInstr
182182
.. attribute:: arg
183183

184184
Argument value: an integer (``int``) in the range ``0``..\
185-
``2,147,483,647``, or :data:`UNSET`. Changing the argument value can
185+
``2,147,483,647``, or :data:`UNSET`. Setting the argument value can
186186
change the instruction size (:attr:`size`).
187187

188188
.. attribute:: size
@@ -237,7 +237,7 @@ Compare
237237
* ``Compare.IN`` (``6``): ``x in y``
238238
* ``Compare.NOT_IN`` (``7``): ``x not in y``
239239
* ``Compare.EXC_MATCH`` (``10``): used to compare exceptions
240-
for ``except:`` block
240+
in ``except:`` blocks
241241

242242

243243
Label
@@ -348,7 +348,7 @@ Bytecode
348348

349349
Static methods:
350350

351-
.. staticmethod:: from_code() -> Bytecode
351+
.. staticmethod:: from_code(code) -> Bytecode
352352

353353
Create an abstract bytecode from a Python code object.
354354

@@ -401,7 +401,7 @@ ConcreteBytecode
401401

402402
Static methods:
403403

404-
.. staticmethod:: from_code(\*, extended_arg=false) -> ConcreteBytecode
404+
.. staticmethod:: from_code(code, \*, extended_arg=false) -> ConcreteBytecode
405405

406406
Create a concrete bytecode from a Python code object.
407407

0 commit comments

Comments
 (0)