from \var{traceback} to \var{file}.
This differs from \function{print_tb()} in the
following ways: (1) if \var{traceback} is not \code{None}, it prints a
-header \samp{Traceback (innermost last):}; (2) it prints the
+header \samp{Traceback (most recent call last):}; (2) it prints the
exception \var{type} and \var{value} after the stack trace; (3) if
\var{type} is \exception{SyntaxError} and \var{value} has the appropriate
format, it prints the line where the syntax error occurred with a
\begin{verbatim}
>>> a=1.5+0.5j
>>> float(a)
-Traceback (innermost last):
+Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: can't convert complex to float; use e.g. abs(z)
>>> a.real
\begin{verbatim}
>>> word[0] = 'x'
-Traceback (innermost last):
+Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: object doesn't support item assignment
>>> word[:-1] = 'Splat'
-Traceback (innermost last):
+Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: object doesn't support slice assignment
\end{verbatim}
>>> word[-100:]
'HelpA'
>>> word[-10] # error
-Traceback (innermost last):
+Traceback (most recent call last):
File "<stdin>", line 1
IndexError: string index out of range
\end{verbatim}
... pass
...
>>> function(0, a=0)
-Traceback (innermost last):
+Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: keyword parameter redefined
\end{verbatim}
\begin{verbatim}
>>> f.close()
>>> f.read()
-Traceback (innermost last):
+Traceback (most recent call last):
File "<stdin>", line 1, in ?
ValueError: I/O operation on closed file
\end{verbatim}
\begin{verbatim}
>>> 10 * (1/0)
-Traceback (innermost last):
+Traceback (most recent call last):
File "<stdin>", line 1
ZeroDivisionError: integer division or modulo
>>> 4 + spam*3
-Traceback (innermost last):
+Traceback (most recent call last):
File "<stdin>", line 1
NameError: spam
>>> '2' + 2
-Traceback (innermost last):
+Traceback (most recent call last):
File "<stdin>", line 1
TypeError: illegal argument type for built-in operation
\end{verbatim}
\begin{verbatim}
>>> raise NameError, 'HiThere'
-Traceback (innermost last):
+Traceback (most recent call last):
File "<stdin>", line 1
NameError: HiThere
\end{verbatim}
...
My exception occurred, value: 4
>>> raise MyError, 1
-Traceback (innermost last):
+Traceback (most recent call last):
File "<stdin>", line 1
__main__.MyError: 1
\end{verbatim}
... print 'Goodbye, world!'
...
Goodbye, world!
-Traceback (innermost last):
+Traceback (most recent call last):
File "<stdin>", line 2
KeyboardInterrupt
\end{verbatim}