summaryrefslogtreecommitdiff
path: root/Doc/library/dis.rst
diff options
context:
space:
mode:
authorNick Coghlan <ncoghlan@gmail.com>2013-11-23 00:57:00 +1000
committerNick Coghlan <ncoghlan@gmail.com>2013-11-23 00:57:00 +1000
commit1b37d9c354da62fe73af90dc1bd3167ad7523d91 (patch)
tree2bf9afca5dfcce01a65dc88725d6bf55e0b9d939 /Doc/library/dis.rst
parent43824525752d6c0652c76b2f9b5fc3d22db48d07 (diff)
downloadcpython-1b37d9c354da62fe73af90dc1bd3167ad7523d91.tar.gz
Close #17916: dis.Bytecode based replacement for distb
- Bytecode.from_traceback() alternate constructor - current_offset parameter and attribute Patch by Claudiu Popa
Diffstat (limited to 'Doc/library/dis.rst')
-rw-r--r--Doc/library/dis.rst12
1 files changed, 11 insertions, 1 deletions
diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst
index 78ddf7e18f..2365f0a01f 100644
--- a/Doc/library/dis.rst
+++ b/Doc/library/dis.rst
@@ -44,7 +44,7 @@ The bytecode analysis API allows pieces of Python code to be wrapped in a
:class:`Bytecode` object that provides easy access to details of the
compiled code.
-.. class:: Bytecode(x, *, first_line=None)
+.. class:: Bytecode(x, *, first_line=None, current_offset=None)
Analyse the bytecode corresponding to a function, method, string of
source code, or a code object (as returned by :func:`compile`).
@@ -59,6 +59,16 @@ compiled code.
Otherwise, the source line information (if any) is taken directly from
the disassembled code object.
+ If *current_offset* is not None, it refers to an instruction offset
+ in the disassembled code. Setting this means :meth:`dis` will display
+ a "current instruction" marker against the specified opcode.
+
+ .. classmethod:: from_traceback(tb)
+
+ Construct a :class:`Bytecode` instance from the given traceback,
+ setting *current_offset* to the instruction responsible for the
+ exception.
+
.. data:: codeobj
The compiled code object.