summaryrefslogtreecommitdiffstats
path: root/Doc/library/dis.rst
diff options
context:
space:
mode:
authorNick Coghlan <ncoghlan@gmail.com>2013-11-22 14:57:00 (GMT)
committerNick Coghlan <ncoghlan@gmail.com>2013-11-22 14:57:00 (GMT)
commit50c48b89e3e3399a729f72983bc47996b5c50545 (patch)
tree3017accfaf672975f776227661a1e412b210eb13 /Doc/library/dis.rst
parent8fbdb097cfc6a838a6a447e4a6c7ad497c392ad6 (diff)
downloadcpython-50c48b89e3e3399a729f72983bc47996b5c50545.zip
cpython-50c48b89e3e3399a729f72983bc47996b5c50545.tar.gz
cpython-50c48b89e3e3399a729f72983bc47996b5c50545.tar.bz2
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 78ddf7e..2365f0a 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.