diff options
| author | Michael W. Hudson <mwh@python.net> | 2002-08-15 14:59:02 +0000 |
|---|---|---|
| committer | Michael W. Hudson <mwh@python.net> | 2002-08-15 14:59:02 +0000 |
| commit | dd32a91cc0c8ba178d7ee5e78c30b6920aff66f4 (patch) | |
| tree | 1a2062b54d3445ca788fd63c2bc63984dd85f34a /Doc/lib | |
| parent | add88060c1d1a98c7970e35b326e6a65a17ddf04 (diff) | |
| download | cpython-git-dd32a91cc0c8ba178d7ee5e78c30b6920aff66f4.tar.gz | |
This is my patch
[ 587993 ] SET_LINENO killer
Remove SET_LINENO. Tracing is now supported by inspecting co_lnotab.
Many sundry changes to document and adapt to this change.
Diffstat (limited to 'Doc/lib')
| -rw-r--r-- | Doc/lib/libdis.tex | 27 | ||||
| -rw-r--r-- | Doc/lib/libtraceback.tex | 8 |
2 files changed, 21 insertions, 14 deletions
diff --git a/Doc/lib/libdis.tex b/Doc/lib/libdis.tex index 16b692d756..567c0eed94 100644 --- a/Doc/lib/libdis.tex +++ b/Doc/lib/libdis.tex @@ -23,17 +23,15 @@ the following command can be used to get the disassembly of \begin{verbatim} >>> dis.dis(myfunc) - 0 SET_LINENO 1 - - 3 SET_LINENO 2 - 6 LOAD_GLOBAL 0 (len) - 9 LOAD_FAST 0 (alist) - 12 CALL_FUNCTION 1 - 15 RETURN_VALUE - 16 LOAD_CONST 0 (None) - 19 RETURN_VALUE + 2 0 LOAD_GLOBAL 0 (len) + 3 LOAD_FAST 0 (alist) + 6 CALL_FUNCTION 1 + 9 RETURN_VALUE + 10 RETURN_NONE \end{verbatim} +(The ``2'' is a line number). + The \module{dis} module defines the following functions and constants: \begin{funcdesc}{dis}{\optional{bytesource}} @@ -56,6 +54,7 @@ Disassembles a code object, indicating the last instruction if \var{lasti} was provided. The output is divided in the following columns: \begin{enumerate} +\item the line number, for the first instruction of each line \item the current instruction, indicated as \samp{-->}, \item a labelled instruction, indicated with \samp{>\code{>}}, \item the address of the instruction, @@ -402,6 +401,14 @@ is evaluated, the locals are passed to the class definition. Returns with TOS to the caller of the function. \end{opcodedesc} +\begin{opcodedesc}{RETURN_NONE}{} +Returns \constant{None} to the caller of the function. This opcode is +generated as the last opcode of every function and only then, for +reasons to do with tracing support. See the comments in the function +\cfunction{maybe_call_line_trace} in \file{Python/ceval.c} for the +gory details. \versionadded{2.3}. +\end{opcodedesc} + \begin{opcodedesc}{YIELD_VALUE}{} Pops \code{TOS} and yields it from a generator. \end{opcodedesc} @@ -621,7 +628,7 @@ free variable storage. \end{opcodedesc} \begin{opcodedesc}{SET_LINENO}{lineno} -Sets the current line number to \var{lineno}. +This opcode is obsolete. \end{opcodedesc} \begin{opcodedesc}{RAISE_VARARGS}{argc} diff --git a/Doc/lib/libtraceback.tex b/Doc/lib/libtraceback.tex index 2b20b0c8a1..a74613bbcf 100644 --- a/Doc/lib/libtraceback.tex +++ b/Doc/lib/libtraceback.tex @@ -118,10 +118,10 @@ A shorthand for \code{format_list(extract_stack(\var{f}, \var{limit}))}. \begin{funcdesc}{tb_lineno}{tb} This function returns the current line number set in the traceback -object. This is normally the same as the \code{\var{tb}.tb_lineno} -field of the object, but when optimization is used (the -O flag) this -field is not updated correctly; this function calculates the correct -value. +object. This function was necessary because in versions of Python +prior to 2.3 when the \programopt{O} flag was passed to Python the +\code{\var{tb}.tb_lineno} was not updated correctly. This function +has no use in versions past 2.3. \end{funcdesc} |
