2007-08-15 11:28:22 -03:00
|
|
|
:mod:`traceback` --- Print or retrieve a stack traceback
|
|
|
|
========================================================
|
|
|
|
|
|
|
|
.. module:: traceback
|
|
|
|
:synopsis: Print or retrieve a stack traceback.
|
|
|
|
|
2016-06-11 16:02:54 -03:00
|
|
|
**Source code:** :source:`Lib/traceback.py`
|
|
|
|
|
|
|
|
--------------
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
This module provides a standard interface to extract, format and print stack
|
|
|
|
traces of Python programs. It exactly mimics the behavior of the Python
|
|
|
|
interpreter when it prints a stack trace. This is useful when you want to print
|
|
|
|
stack traces under program control, such as in a "wrapper" around the
|
|
|
|
interpreter.
|
|
|
|
|
2023-05-04 07:04:41 -03:00
|
|
|
.. index:: pair: object; traceback
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2023-02-20 17:54:19 -04:00
|
|
|
The module uses traceback objects --- these are objects of type :class:`types.TracebackType`,
|
|
|
|
which are assigned to the ``__traceback__`` field of :class:`BaseException` instances.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2023-02-03 23:49:29 -04:00
|
|
|
.. seealso::
|
|
|
|
|
|
|
|
Module :mod:`faulthandler`
|
|
|
|
Used to dump Python tracebacks explicitly, on a fault, after a timeout, or on a user signal.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2023-02-03 23:49:29 -04:00
|
|
|
Module :mod:`pdb`
|
|
|
|
Interactive source code debugger for Python programs.
|
|
|
|
|
|
|
|
The module defines the following functions:
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2016-01-16 01:45:17 -04:00
|
|
|
.. function:: print_tb(tb, limit=None, file=None)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2016-01-16 01:45:17 -04:00
|
|
|
Print up to *limit* stack trace entries from traceback object *tb* (starting
|
|
|
|
from the caller's frame) if *limit* is positive. Otherwise, print the last
|
|
|
|
``abs(limit)`` entries. If *limit* is omitted or ``None``, all entries are
|
|
|
|
printed. If *file* is omitted or ``None``, the output goes to
|
|
|
|
``sys.stderr``; otherwise it should be an open file or file-like object to
|
|
|
|
receive the output.
|
2015-05-03 07:19:46 -03:00
|
|
|
|
|
|
|
.. versionchanged:: 3.5
|
|
|
|
Added negative *limit* support.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2020-11-05 18:18:44 -04:00
|
|
|
.. function:: print_exception(exc, /[, value, tb], limit=None, \
|
|
|
|
file=None, chain=True)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2016-01-16 01:45:17 -04:00
|
|
|
Print exception information and stack trace entries from traceback object
|
|
|
|
*tb* to *file*. This differs from :func:`print_tb` in the following
|
2008-07-19 12:51:07 -03:00
|
|
|
ways:
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2016-01-16 01:45:17 -04:00
|
|
|
* if *tb* is not ``None``, it prints a header ``Traceback (most recent
|
2008-07-19 12:51:07 -03:00
|
|
|
call last):``
|
2018-10-26 03:00:49 -03:00
|
|
|
|
2020-11-05 18:18:44 -04:00
|
|
|
* it prints the exception type and *value* after the stack trace
|
2018-10-26 03:00:49 -03:00
|
|
|
|
2018-10-28 08:41:26 -03:00
|
|
|
.. index:: single: ^ (caret); marker
|
2018-10-26 03:00:49 -03:00
|
|
|
|
2017-06-01 18:54:01 -03:00
|
|
|
* if *type(value)* is :exc:`SyntaxError` and *value* has the appropriate
|
|
|
|
format, it prints the line where the syntax error occurred with a caret
|
|
|
|
indicating the approximate position of the error.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2020-11-05 18:18:44 -04:00
|
|
|
Since Python 3.10, instead of passing *value* and *tb*, an exception object
|
|
|
|
can be passed as the first argument. If *value* and *tb* are provided, the
|
|
|
|
first argument is ignored in order to provide backwards compatibility.
|
|
|
|
|
2015-05-03 07:19:46 -03:00
|
|
|
The optional *limit* argument has the same meaning as for :func:`print_tb`.
|
2008-07-19 12:51:07 -03:00
|
|
|
If *chain* is true (the default), then chained exceptions (the
|
|
|
|
:attr:`__cause__` or :attr:`__context__` attributes of the exception) will be
|
|
|
|
printed as well, like the interpreter itself does when printing an unhandled
|
|
|
|
exception.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2017-06-01 18:54:01 -03:00
|
|
|
.. versionchanged:: 3.5
|
|
|
|
The *etype* argument is ignored and inferred from the type of *value*.
|
|
|
|
|
2020-11-05 18:18:44 -04:00
|
|
|
.. versionchanged:: 3.10
|
|
|
|
The *etype* parameter has been renamed to *exc* and is now
|
|
|
|
positional-only.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2009-09-16 12:58:14 -03:00
|
|
|
.. function:: print_exc(limit=None, file=None, chain=True)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2023-02-20 17:54:19 -04:00
|
|
|
This is a shorthand for ``print_exception(sys.exception(), limit, file,
|
2015-05-03 07:19:46 -03:00
|
|
|
chain)``.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2009-09-16 12:58:14 -03:00
|
|
|
.. function:: print_last(limit=None, file=None, chain=True)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2023-06-02 13:01:46 -03:00
|
|
|
This is a shorthand for ``print_exception(sys.last_exc, limit, file,
|
|
|
|
chain)``. In general it will work only after an exception has reached
|
|
|
|
an interactive prompt (see :data:`sys.last_exc`).
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2009-09-16 12:58:14 -03:00
|
|
|
.. function:: print_stack(f=None, limit=None, file=None)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2015-05-03 07:19:46 -03:00
|
|
|
Print up to *limit* stack trace entries (starting from the invocation
|
|
|
|
point) if *limit* is positive. Otherwise, print the last ``abs(limit)``
|
|
|
|
entries. If *limit* is omitted or ``None``, all entries are printed.
|
|
|
|
The optional *f* argument can be used to specify an alternate stack frame
|
|
|
|
to start. The optional *file* argument has the same meaning as for
|
|
|
|
:func:`print_tb`.
|
|
|
|
|
|
|
|
.. versionchanged:: 3.5
|
|
|
|
Added negative *limit* support.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2016-01-16 01:45:17 -04:00
|
|
|
.. function:: extract_tb(tb, limit=None)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2018-08-02 13:08:59 -03:00
|
|
|
Return a :class:`StackSummary` object representing a list of "pre-processed"
|
|
|
|
stack trace entries extracted from the traceback object *tb*. It is useful
|
|
|
|
for alternate formatting of stack traces. The optional *limit* argument has
|
|
|
|
the same meaning as for :func:`print_tb`. A "pre-processed" stack trace
|
|
|
|
entry is a :class:`FrameSummary` object containing attributes
|
|
|
|
:attr:`~FrameSummary.filename`, :attr:`~FrameSummary.lineno`,
|
|
|
|
:attr:`~FrameSummary.name`, and :attr:`~FrameSummary.line` representing the
|
|
|
|
information that is usually printed for a stack trace. The
|
|
|
|
:attr:`~FrameSummary.line` is a string with leading and trailing
|
|
|
|
whitespace stripped; if the source is not available it is ``None``.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2009-09-16 12:58:14 -03:00
|
|
|
.. function:: extract_stack(f=None, limit=None)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Extract the raw traceback from the current stack frame. The return value has
|
|
|
|
the same format as for :func:`extract_tb`. The optional *f* and *limit*
|
|
|
|
arguments have the same meaning as for :func:`print_stack`.
|
|
|
|
|
|
|
|
|
2016-01-16 01:45:17 -04:00
|
|
|
.. function:: format_list(extracted_list)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2018-08-02 13:08:59 -03:00
|
|
|
Given a list of tuples or :class:`FrameSummary` objects as returned by
|
|
|
|
:func:`extract_tb` or :func:`extract_stack`, return a list of strings ready
|
|
|
|
for printing. Each string in the resulting list corresponds to the item with
|
|
|
|
the same index in the argument list. Each string ends in a newline; the
|
|
|
|
strings may contain internal newlines as well, for those items whose source
|
|
|
|
text line is not ``None``.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2020-11-05 18:18:44 -04:00
|
|
|
.. function:: format_exception_only(exc, /[, value])
|
|
|
|
|
|
|
|
Format the exception part of a traceback using an exception value such as
|
|
|
|
given by ``sys.last_value``. The return value is a list of strings, each
|
|
|
|
ending in a newline. Normally, the list contains a single string; however,
|
|
|
|
for :exc:`SyntaxError` exceptions, it contains several lines that (when
|
|
|
|
printed) display detailed information about where the syntax error occurred.
|
|
|
|
The message indicating which exception occurred is the always last string in
|
|
|
|
the list.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2020-11-05 18:18:44 -04:00
|
|
|
Since Python 3.10, instead of passing *value*, an exception object
|
|
|
|
can be passed as the first argument. If *value* is provided, the first
|
|
|
|
argument is ignored in order to provide backwards compatibility.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2020-11-05 18:18:44 -04:00
|
|
|
.. versionchanged:: 3.10
|
|
|
|
The *etype* parameter has been renamed to *exc* and is now
|
|
|
|
positional-only.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2020-11-05 18:18:44 -04:00
|
|
|
|
|
|
|
.. function:: format_exception(exc, /[, value, tb], limit=None, chain=True)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Format a stack trace and the exception information. The arguments have the
|
|
|
|
same meaning as the corresponding arguments to :func:`print_exception`. The
|
2016-01-16 01:45:17 -04:00
|
|
|
return value is a list of strings, each ending in a newline and some
|
|
|
|
containing internal newlines. When these lines are concatenated and printed,
|
|
|
|
exactly the same text is printed as does :func:`print_exception`.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2017-06-01 18:54:01 -03:00
|
|
|
.. versionchanged:: 3.5
|
|
|
|
The *etype* argument is ignored and inferred from the type of *value*.
|
|
|
|
|
2020-11-05 18:18:44 -04:00
|
|
|
.. versionchanged:: 3.10
|
|
|
|
This function's behavior and signature were modified to match
|
|
|
|
:func:`print_exception`.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2009-09-16 12:58:14 -03:00
|
|
|
.. function:: format_exc(limit=None, chain=True)
|
2008-07-19 12:51:07 -03:00
|
|
|
|
2016-01-16 01:45:17 -04:00
|
|
|
This is like ``print_exc(limit)`` but returns a string instead of printing to
|
|
|
|
a file.
|
2008-07-19 12:51:07 -03:00
|
|
|
|
|
|
|
|
2009-09-16 12:58:14 -03:00
|
|
|
.. function:: format_tb(tb, limit=None)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
A shorthand for ``format_list(extract_tb(tb, limit))``.
|
|
|
|
|
|
|
|
|
2009-09-16 12:58:14 -03:00
|
|
|
.. function:: format_stack(f=None, limit=None)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
A shorthand for ``format_list(extract_stack(f, limit))``.
|
|
|
|
|
2013-09-15 19:15:56 -03:00
|
|
|
.. function:: clear_frames(tb)
|
|
|
|
|
|
|
|
Clears the local variables of all the stack frames in a traceback *tb*
|
|
|
|
by calling the :meth:`clear` method of each frame object.
|
|
|
|
|
|
|
|
.. versionadded:: 3.4
|
|
|
|
|
2015-03-04 19:07:57 -04:00
|
|
|
.. function:: walk_stack(f)
|
|
|
|
|
2015-03-06 06:18:06 -04:00
|
|
|
Walk a stack following ``f.f_back`` from the given frame, yielding the frame
|
|
|
|
and line number for each frame. If *f* is ``None``, the current stack is
|
|
|
|
used. This helper is used with :meth:`StackSummary.extract`.
|
2015-03-04 19:07:57 -04:00
|
|
|
|
|
|
|
.. versionadded:: 3.5
|
|
|
|
|
|
|
|
.. function:: walk_tb(tb)
|
|
|
|
|
2015-03-06 06:18:06 -04:00
|
|
|
Walk a traceback following ``tb_next`` yielding the frame and line number
|
|
|
|
for each frame. This helper is used with :meth:`StackSummary.extract`.
|
2015-03-04 19:07:57 -04:00
|
|
|
|
|
|
|
.. versionadded:: 3.5
|
|
|
|
|
|
|
|
The module also defines the following classes:
|
|
|
|
|
|
|
|
:class:`TracebackException` Objects
|
|
|
|
-----------------------------------
|
|
|
|
|
2015-03-06 06:18:06 -04:00
|
|
|
.. versionadded:: 3.5
|
|
|
|
|
|
|
|
:class:`TracebackException` objects are created from actual exceptions to
|
2015-03-04 19:07:57 -04:00
|
|
|
capture data for later printing in a lightweight fashion.
|
|
|
|
|
2023-05-29 15:28:37 -03:00
|
|
|
.. class:: TracebackException(exc_type, exc_value, exc_traceback, *, limit=None, lookup_lines=True, capture_locals=False, compact=False, max_group_width=15, max_group_depth=10)
|
2015-03-04 19:07:57 -04:00
|
|
|
|
2015-03-06 06:18:06 -04:00
|
|
|
Capture an exception for later rendering. *limit*, *lookup_lines* and
|
|
|
|
*capture_locals* are as for the :class:`StackSummary` class.
|
2015-03-05 03:28:52 -04:00
|
|
|
|
2021-01-14 22:45:02 -04:00
|
|
|
If *compact* is true, only data that is required by :class:`TracebackException`'s
|
|
|
|
``format`` method is saved in the class attributes. In particular, the
|
|
|
|
``__context__`` field is calculated only if ``__cause__`` is ``None`` and
|
|
|
|
``__suppress_context__`` is false.
|
|
|
|
|
2015-03-05 03:28:52 -04:00
|
|
|
Note that when locals are captured, they are also shown in the traceback.
|
2015-03-04 19:07:57 -04:00
|
|
|
|
2023-05-29 15:28:37 -03:00
|
|
|
*max_group_width* and *max_group_depth* control the formatting of exception
|
|
|
|
groups (see :exc:`BaseExceptionGroup`). The depth refers to the nesting
|
|
|
|
level of the group, and the width refers to the size of a single exception
|
|
|
|
group's exceptions array. The formatted output is truncated when either
|
|
|
|
limit is exceeded.
|
|
|
|
|
2015-03-06 06:18:06 -04:00
|
|
|
.. attribute:: __cause__
|
2015-03-04 19:07:57 -04:00
|
|
|
|
2015-03-06 06:18:06 -04:00
|
|
|
A :class:`TracebackException` of the original ``__cause__``.
|
2015-03-05 03:28:52 -04:00
|
|
|
|
2015-03-06 06:18:06 -04:00
|
|
|
.. attribute:: __context__
|
2015-03-04 19:07:57 -04:00
|
|
|
|
2015-03-06 06:18:06 -04:00
|
|
|
A :class:`TracebackException` of the original ``__context__``.
|
2015-03-04 19:07:57 -04:00
|
|
|
|
2023-05-29 15:28:37 -03:00
|
|
|
.. attribute:: exceptions
|
|
|
|
|
|
|
|
If ``self`` represents an :exc:`ExceptionGroup`, this field holds a list of
|
|
|
|
:class:`TracebackException` instances representing the nested exceptions.
|
|
|
|
Otherwise it is ``None``.
|
|
|
|
|
|
|
|
.. versionadded:: 3.11
|
|
|
|
|
2015-03-06 06:18:06 -04:00
|
|
|
.. attribute:: __suppress_context__
|
2015-03-04 19:07:57 -04:00
|
|
|
|
2015-03-06 06:18:06 -04:00
|
|
|
The ``__suppress_context__`` value from the original exception.
|
2015-03-04 19:07:57 -04:00
|
|
|
|
2022-04-20 09:43:10 -03:00
|
|
|
.. attribute:: __notes__
|
|
|
|
|
|
|
|
The ``__notes__`` value from the original exception, or ``None``
|
|
|
|
if the exception does not have any notes. If it is not ``None``
|
|
|
|
is it formatted in the traceback after the exception string.
|
|
|
|
|
|
|
|
.. versionadded:: 3.11
|
|
|
|
|
2015-03-06 06:18:06 -04:00
|
|
|
.. attribute:: stack
|
2015-03-04 19:07:57 -04:00
|
|
|
|
2015-03-06 06:18:06 -04:00
|
|
|
A :class:`StackSummary` representing the traceback.
|
2015-03-04 19:07:57 -04:00
|
|
|
|
2015-03-06 06:18:06 -04:00
|
|
|
.. attribute:: exc_type
|
2015-03-04 19:07:57 -04:00
|
|
|
|
2015-03-06 06:18:06 -04:00
|
|
|
The class of the original traceback.
|
2015-03-04 19:07:57 -04:00
|
|
|
|
2015-03-06 06:18:06 -04:00
|
|
|
.. attribute:: filename
|
2015-03-04 19:07:57 -04:00
|
|
|
|
2015-03-06 06:18:06 -04:00
|
|
|
For syntax errors - the file name where the error occurred.
|
2015-03-04 19:07:57 -04:00
|
|
|
|
2015-03-06 06:18:06 -04:00
|
|
|
.. attribute:: lineno
|
2015-03-04 19:07:57 -04:00
|
|
|
|
2015-03-06 06:18:06 -04:00
|
|
|
For syntax errors - the line number where the error occurred.
|
2015-03-04 19:07:57 -04:00
|
|
|
|
2023-06-05 13:10:13 -03:00
|
|
|
.. attribute:: end_lineno
|
|
|
|
|
|
|
|
For syntax errors - the end line number where the error occurred.
|
|
|
|
Can be ``None`` if not present.
|
|
|
|
|
|
|
|
.. versionadded:: 3.10
|
|
|
|
|
2015-03-06 06:18:06 -04:00
|
|
|
.. attribute:: text
|
2015-03-04 19:07:57 -04:00
|
|
|
|
2015-03-06 06:18:06 -04:00
|
|
|
For syntax errors - the text where the error occurred.
|
2015-03-04 19:07:57 -04:00
|
|
|
|
2015-03-06 06:18:06 -04:00
|
|
|
.. attribute:: offset
|
2015-03-04 19:07:57 -04:00
|
|
|
|
2015-03-06 06:18:06 -04:00
|
|
|
For syntax errors - the offset into the text where the error occurred.
|
2015-03-04 19:07:57 -04:00
|
|
|
|
2023-06-05 13:10:13 -03:00
|
|
|
.. attribute:: end_offset
|
|
|
|
|
|
|
|
For syntax errors - the end offset into the text where the error occurred.
|
|
|
|
Can be ``None`` if not present.
|
|
|
|
|
|
|
|
.. versionadded:: 3.10
|
|
|
|
|
2015-03-06 06:18:06 -04:00
|
|
|
.. attribute:: msg
|
|
|
|
|
|
|
|
For syntax errors - the compiler error message.
|
|
|
|
|
|
|
|
.. classmethod:: from_exception(exc, *, limit=None, lookup_lines=True, capture_locals=False)
|
|
|
|
|
|
|
|
Capture an exception for later rendering. *limit*, *lookup_lines* and
|
|
|
|
*capture_locals* are as for the :class:`StackSummary` class.
|
|
|
|
|
|
|
|
Note that when locals are captured, they are also shown in the traceback.
|
|
|
|
|
2021-05-22 13:39:33 -03:00
|
|
|
.. method:: print(*, file=None, chain=True)
|
|
|
|
|
|
|
|
Print to *file* (default ``sys.stderr``) the exception information returned by
|
|
|
|
:meth:`format`.
|
|
|
|
|
|
|
|
.. versionadded:: 3.11
|
|
|
|
|
2015-03-06 06:18:06 -04:00
|
|
|
.. method:: format(*, chain=True)
|
|
|
|
|
|
|
|
Format the exception.
|
|
|
|
|
|
|
|
If *chain* is not ``True``, ``__cause__`` and ``__context__`` will not
|
|
|
|
be formatted.
|
|
|
|
|
|
|
|
The return value is a generator of strings, each ending in a newline and
|
|
|
|
some containing internal newlines. :func:`~traceback.print_exception`
|
|
|
|
is a wrapper around this method which just prints the lines to a file.
|
|
|
|
|
|
|
|
The message indicating which exception occurred is always the last
|
|
|
|
string in the output.
|
|
|
|
|
2023-06-06 06:26:18 -03:00
|
|
|
.. method:: format_exception_only(*, show_group=False)
|
2015-03-06 06:18:06 -04:00
|
|
|
|
|
|
|
Format the exception part of the traceback.
|
|
|
|
|
|
|
|
The return value is a generator of strings, each ending in a newline.
|
|
|
|
|
2023-06-06 06:26:18 -03:00
|
|
|
When *show_group* is ``False``, the generator normally emits a single
|
|
|
|
string; however, for :exc:`SyntaxError` exceptions, it emits several
|
|
|
|
lines that (when printed) display detailed information about where
|
|
|
|
the syntax error occurred. The message indicating which exception
|
|
|
|
occurred is always the last string in the output.
|
2015-03-06 06:18:06 -04:00
|
|
|
|
2023-06-06 06:26:18 -03:00
|
|
|
When *show_group* is ``True``, and the exception is an instance of
|
|
|
|
:exc:`BaseExceptionGroup`, the nested exceptions are included as
|
|
|
|
well, recursively, with indentation relative to their nesting depth.
|
|
|
|
|
|
|
|
.. versionchanged:: 3.13
|
|
|
|
Added the *show_group* parameter.
|
2015-03-04 19:07:57 -04:00
|
|
|
|
2021-01-14 22:45:02 -04:00
|
|
|
.. versionchanged:: 3.10
|
|
|
|
Added the *compact* parameter.
|
|
|
|
|
2023-05-29 15:28:37 -03:00
|
|
|
.. versionchanged:: 3.11
|
|
|
|
Added the *max_group_width* and *max_group_depth* parameters.
|
|
|
|
|
2015-03-04 19:07:57 -04:00
|
|
|
|
2023-06-06 06:26:18 -03:00
|
|
|
|
2015-03-04 19:07:57 -04:00
|
|
|
:class:`StackSummary` Objects
|
|
|
|
-----------------------------
|
|
|
|
|
2015-03-06 06:18:06 -04:00
|
|
|
.. versionadded:: 3.5
|
2015-03-04 19:07:57 -04:00
|
|
|
|
2015-03-06 06:18:06 -04:00
|
|
|
:class:`StackSummary` objects represent a call stack ready for formatting.
|
2015-03-04 19:07:57 -04:00
|
|
|
|
2015-03-06 06:18:06 -04:00
|
|
|
.. class:: StackSummary
|
2015-03-04 19:07:57 -04:00
|
|
|
|
2015-03-06 06:18:06 -04:00
|
|
|
.. classmethod:: extract(frame_gen, *, limit=None, lookup_lines=True, capture_locals=False)
|
2015-03-04 19:07:57 -04:00
|
|
|
|
2015-03-06 06:18:06 -04:00
|
|
|
Construct a :class:`StackSummary` object from a frame generator (such as
|
|
|
|
is returned by :func:`~traceback.walk_stack` or
|
|
|
|
:func:`~traceback.walk_tb`).
|
2015-03-04 19:07:57 -04:00
|
|
|
|
2015-03-06 06:18:06 -04:00
|
|
|
If *limit* is supplied, only this many frames are taken from *frame_gen*.
|
|
|
|
If *lookup_lines* is ``False``, the returned :class:`FrameSummary`
|
|
|
|
objects will not have read their lines in yet, making the cost of
|
|
|
|
creating the :class:`StackSummary` cheaper (which may be valuable if it
|
|
|
|
may not actually get formatted). If *capture_locals* is ``True`` the
|
|
|
|
local variables in each :class:`FrameSummary` are captured as object
|
|
|
|
representations.
|
2015-03-04 19:07:57 -04:00
|
|
|
|
2022-07-11 06:14:15 -03:00
|
|
|
.. versionchanged:: 3.12
|
|
|
|
Exceptions raised from :func:`repr` on a local variable (when
|
|
|
|
*capture_locals* is ``True``) are no longer propagated to the caller.
|
|
|
|
|
2015-03-06 06:18:06 -04:00
|
|
|
.. classmethod:: from_list(a_list)
|
|
|
|
|
2018-08-02 13:08:59 -03:00
|
|
|
Construct a :class:`StackSummary` object from a supplied list of
|
|
|
|
:class:`FrameSummary` objects or old-style list of tuples. Each tuple
|
|
|
|
should be a 4-tuple with filename, lineno, name, line as the elements.
|
2015-03-04 19:07:57 -04:00
|
|
|
|
2016-08-15 00:11:34 -03:00
|
|
|
.. method:: format()
|
|
|
|
|
|
|
|
Returns a list of strings ready for printing. Each string in the
|
|
|
|
resulting list corresponds to a single frame from the stack.
|
|
|
|
Each string ends in a newline; the strings may contain internal
|
|
|
|
newlines as well, for those items with source text lines.
|
|
|
|
|
|
|
|
For long sequences of the same frame and line, the first few
|
|
|
|
repetitions are shown, followed by a summary line stating the exact
|
|
|
|
number of further repetitions.
|
|
|
|
|
2016-08-15 21:58:14 -03:00
|
|
|
.. versionchanged:: 3.6
|
|
|
|
Long sequences of repeated frames are now abbreviated.
|
2016-08-15 00:11:34 -03:00
|
|
|
|
2021-09-03 18:39:23 -03:00
|
|
|
.. method:: format_frame_summary(frame_summary)
|
2021-07-16 09:21:16 -03:00
|
|
|
|
|
|
|
Returns a string for printing one of the frames involved in the stack.
|
2021-09-03 18:39:23 -03:00
|
|
|
This method is called for each :class:`FrameSummary` object to be
|
|
|
|
printed by :meth:`StackSummary.format`. If it returns ``None``, the
|
|
|
|
frame is omitted from the output.
|
2021-07-16 09:21:16 -03:00
|
|
|
|
|
|
|
.. versionadded:: 3.11
|
|
|
|
|
2015-03-04 19:07:57 -04:00
|
|
|
|
|
|
|
:class:`FrameSummary` Objects
|
|
|
|
-----------------------------
|
|
|
|
|
2015-03-06 06:18:06 -04:00
|
|
|
.. versionadded:: 3.5
|
|
|
|
|
2021-09-03 18:39:23 -03:00
|
|
|
A :class:`FrameSummary` object represents a single frame in a traceback.
|
2015-03-04 19:07:57 -04:00
|
|
|
|
|
|
|
.. class:: FrameSummary(filename, lineno, name, lookup_line=True, locals=None, line=None)
|
|
|
|
|
|
|
|
Represent a single frame in the traceback or stack that is being formatted
|
|
|
|
or printed. It may optionally have a stringified version of the frames
|
2015-03-06 06:18:06 -04:00
|
|
|
locals included in it. If *lookup_line* is ``False``, the source code is not
|
|
|
|
looked up until the :class:`FrameSummary` has the :attr:`~FrameSummary.line`
|
|
|
|
attribute accessed (which also happens when casting it to a tuple).
|
|
|
|
:attr:`~FrameSummary.line` may be directly provided, and will prevent line
|
|
|
|
lookups happening at all. *locals* is an optional local variable
|
|
|
|
dictionary, and if supplied the variable representations are stored in the
|
|
|
|
summary for later display.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
.. _traceback-example:
|
|
|
|
|
Merged revisions 59333-59370 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59343 | georg.brandl | 2007-12-05 08:02:47 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix typo.
........
r59347 | christian.heimes | 2007-12-05 13:31:44 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed quoting and paths in the sqlite project file
........
r59348 | christian.heimes | 2007-12-05 13:45:11 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed error in regrtest. I must have missed the spot.
........
r59350 | christian.heimes | 2007-12-05 13:49:14 +0100 (Wed, 05 Dec 2007) | 1 line
merge -r59315:59316 from py3k: Fix issue #1553: An errornous __length_hint__ can make list() raise a SystemError
........
r59352 | christian.heimes | 2007-12-05 13:52:34 +0100 (Wed, 05 Dec 2007) | 1 line
Added msg to Misc/NEWS
........
r59354 | andrew.kuchling | 2007-12-05 14:27:20 +0100 (Wed, 05 Dec 2007) | 1 line
Spelling fix
........
r59356 | georg.brandl | 2007-12-05 18:56:50 +0100 (Wed, 05 Dec 2007) | 3 lines
Add examples to csv, pprint and traceback docs.
Written by Ross for GHOP.
........
r59358 | raymond.hettinger | 2007-12-05 19:11:08 +0100 (Wed, 05 Dec 2007) | 1 line
Error checking was too aggressive (reported by Chris Tismer)
........
r59359 | georg.brandl | 2007-12-05 19:30:48 +0100 (Wed, 05 Dec 2007) | 2 lines
Add examples to re docs. Written for GHOP by Dan Finnie.
........
r59366 | georg.brandl | 2007-12-05 20:49:21 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix markup.
........
r59367 | christian.heimes | 2007-12-05 20:57:54 +0100 (Wed, 05 Dec 2007) | 1 line
Updated documentation and build_tkinter.py script
........
r59368 | georg.brandl | 2007-12-05 21:03:57 +0100 (Wed, 05 Dec 2007) | 2 lines
Another markup fix.
........
r59369 | ronald.oussoren | 2007-12-05 21:07:36 +0100 (Wed, 05 Dec 2007) | 7 lines
This "fixes" compilation issues for the Carbon._OSA module on OSX Leopard
by purging bindings to OSA's debug API's. Those APIs we're completely
unsupported on OSX 10.4 and are no longer available on OSX 10.5.
Note that this patches a generated file. This is somewhat acceptable because
regenerating the file is non-trivial and wouldn't use system headers anyway.
........
r59370 | christian.heimes | 2007-12-05 21:10:38 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed bug #1557 by using popen.communicate() before popen.wait()
........
2007-12-05 16:18:38 -04:00
|
|
|
Traceback Examples
|
|
|
|
------------------
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
This simple example implements a basic read-eval-print loop, similar to (but
|
|
|
|
less useful than) the standard Python interactive interpreter loop. For a more
|
|
|
|
complete implementation of the interpreter loop, refer to the :mod:`code`
|
|
|
|
module. ::
|
|
|
|
|
|
|
|
import sys, traceback
|
|
|
|
|
|
|
|
def run_user_code(envdir):
|
2007-12-02 18:48:17 -04:00
|
|
|
source = input(">>> ")
|
2007-08-15 11:28:22 -03:00
|
|
|
try:
|
|
|
|
exec(source, envdir)
|
2012-11-02 17:07:26 -03:00
|
|
|
except Exception:
|
2007-09-01 20:34:30 -03:00
|
|
|
print("Exception in user code:")
|
|
|
|
print("-"*60)
|
2007-08-15 11:28:22 -03:00
|
|
|
traceback.print_exc(file=sys.stdout)
|
2007-09-01 20:34:30 -03:00
|
|
|
print("-"*60)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
envdir = {}
|
2007-09-01 20:34:30 -03:00
|
|
|
while True:
|
2007-08-15 11:28:22 -03:00
|
|
|
run_user_code(envdir)
|
|
|
|
|
Merged revisions 59333-59370 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59343 | georg.brandl | 2007-12-05 08:02:47 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix typo.
........
r59347 | christian.heimes | 2007-12-05 13:31:44 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed quoting and paths in the sqlite project file
........
r59348 | christian.heimes | 2007-12-05 13:45:11 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed error in regrtest. I must have missed the spot.
........
r59350 | christian.heimes | 2007-12-05 13:49:14 +0100 (Wed, 05 Dec 2007) | 1 line
merge -r59315:59316 from py3k: Fix issue #1553: An errornous __length_hint__ can make list() raise a SystemError
........
r59352 | christian.heimes | 2007-12-05 13:52:34 +0100 (Wed, 05 Dec 2007) | 1 line
Added msg to Misc/NEWS
........
r59354 | andrew.kuchling | 2007-12-05 14:27:20 +0100 (Wed, 05 Dec 2007) | 1 line
Spelling fix
........
r59356 | georg.brandl | 2007-12-05 18:56:50 +0100 (Wed, 05 Dec 2007) | 3 lines
Add examples to csv, pprint and traceback docs.
Written by Ross for GHOP.
........
r59358 | raymond.hettinger | 2007-12-05 19:11:08 +0100 (Wed, 05 Dec 2007) | 1 line
Error checking was too aggressive (reported by Chris Tismer)
........
r59359 | georg.brandl | 2007-12-05 19:30:48 +0100 (Wed, 05 Dec 2007) | 2 lines
Add examples to re docs. Written for GHOP by Dan Finnie.
........
r59366 | georg.brandl | 2007-12-05 20:49:21 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix markup.
........
r59367 | christian.heimes | 2007-12-05 20:57:54 +0100 (Wed, 05 Dec 2007) | 1 line
Updated documentation and build_tkinter.py script
........
r59368 | georg.brandl | 2007-12-05 21:03:57 +0100 (Wed, 05 Dec 2007) | 2 lines
Another markup fix.
........
r59369 | ronald.oussoren | 2007-12-05 21:07:36 +0100 (Wed, 05 Dec 2007) | 7 lines
This "fixes" compilation issues for the Carbon._OSA module on OSX Leopard
by purging bindings to OSA's debug API's. Those APIs we're completely
unsupported on OSX 10.4 and are no longer available on OSX 10.5.
Note that this patches a generated file. This is somewhat acceptable because
regenerating the file is non-trivial and wouldn't use system headers anyway.
........
r59370 | christian.heimes | 2007-12-05 21:10:38 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed bug #1557 by using popen.communicate() before popen.wait()
........
2007-12-05 16:18:38 -04:00
|
|
|
|
|
|
|
The following example demonstrates the different ways to print and format the
|
2009-04-27 15:38:19 -03:00
|
|
|
exception and traceback:
|
|
|
|
|
|
|
|
.. testcode::
|
Merged revisions 59333-59370 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59343 | georg.brandl | 2007-12-05 08:02:47 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix typo.
........
r59347 | christian.heimes | 2007-12-05 13:31:44 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed quoting and paths in the sqlite project file
........
r59348 | christian.heimes | 2007-12-05 13:45:11 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed error in regrtest. I must have missed the spot.
........
r59350 | christian.heimes | 2007-12-05 13:49:14 +0100 (Wed, 05 Dec 2007) | 1 line
merge -r59315:59316 from py3k: Fix issue #1553: An errornous __length_hint__ can make list() raise a SystemError
........
r59352 | christian.heimes | 2007-12-05 13:52:34 +0100 (Wed, 05 Dec 2007) | 1 line
Added msg to Misc/NEWS
........
r59354 | andrew.kuchling | 2007-12-05 14:27:20 +0100 (Wed, 05 Dec 2007) | 1 line
Spelling fix
........
r59356 | georg.brandl | 2007-12-05 18:56:50 +0100 (Wed, 05 Dec 2007) | 3 lines
Add examples to csv, pprint and traceback docs.
Written by Ross for GHOP.
........
r59358 | raymond.hettinger | 2007-12-05 19:11:08 +0100 (Wed, 05 Dec 2007) | 1 line
Error checking was too aggressive (reported by Chris Tismer)
........
r59359 | georg.brandl | 2007-12-05 19:30:48 +0100 (Wed, 05 Dec 2007) | 2 lines
Add examples to re docs. Written for GHOP by Dan Finnie.
........
r59366 | georg.brandl | 2007-12-05 20:49:21 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix markup.
........
r59367 | christian.heimes | 2007-12-05 20:57:54 +0100 (Wed, 05 Dec 2007) | 1 line
Updated documentation and build_tkinter.py script
........
r59368 | georg.brandl | 2007-12-05 21:03:57 +0100 (Wed, 05 Dec 2007) | 2 lines
Another markup fix.
........
r59369 | ronald.oussoren | 2007-12-05 21:07:36 +0100 (Wed, 05 Dec 2007) | 7 lines
This "fixes" compilation issues for the Carbon._OSA module on OSX Leopard
by purging bindings to OSA's debug API's. Those APIs we're completely
unsupported on OSX 10.4 and are no longer available on OSX 10.5.
Note that this patches a generated file. This is somewhat acceptable because
regenerating the file is non-trivial and wouldn't use system headers anyway.
........
r59370 | christian.heimes | 2007-12-05 21:10:38 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed bug #1557 by using popen.communicate() before popen.wait()
........
2007-12-05 16:18:38 -04:00
|
|
|
|
|
|
|
import sys, traceback
|
|
|
|
|
|
|
|
def lumberjack():
|
2022-09-05 18:30:51 -03:00
|
|
|
bright_side_of_life()
|
2009-01-03 17:18:54 -04:00
|
|
|
|
2022-09-05 18:30:51 -03:00
|
|
|
def bright_side_of_life():
|
Merged revisions 59333-59370 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59343 | georg.brandl | 2007-12-05 08:02:47 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix typo.
........
r59347 | christian.heimes | 2007-12-05 13:31:44 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed quoting and paths in the sqlite project file
........
r59348 | christian.heimes | 2007-12-05 13:45:11 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed error in regrtest. I must have missed the spot.
........
r59350 | christian.heimes | 2007-12-05 13:49:14 +0100 (Wed, 05 Dec 2007) | 1 line
merge -r59315:59316 from py3k: Fix issue #1553: An errornous __length_hint__ can make list() raise a SystemError
........
r59352 | christian.heimes | 2007-12-05 13:52:34 +0100 (Wed, 05 Dec 2007) | 1 line
Added msg to Misc/NEWS
........
r59354 | andrew.kuchling | 2007-12-05 14:27:20 +0100 (Wed, 05 Dec 2007) | 1 line
Spelling fix
........
r59356 | georg.brandl | 2007-12-05 18:56:50 +0100 (Wed, 05 Dec 2007) | 3 lines
Add examples to csv, pprint and traceback docs.
Written by Ross for GHOP.
........
r59358 | raymond.hettinger | 2007-12-05 19:11:08 +0100 (Wed, 05 Dec 2007) | 1 line
Error checking was too aggressive (reported by Chris Tismer)
........
r59359 | georg.brandl | 2007-12-05 19:30:48 +0100 (Wed, 05 Dec 2007) | 2 lines
Add examples to re docs. Written for GHOP by Dan Finnie.
........
r59366 | georg.brandl | 2007-12-05 20:49:21 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix markup.
........
r59367 | christian.heimes | 2007-12-05 20:57:54 +0100 (Wed, 05 Dec 2007) | 1 line
Updated documentation and build_tkinter.py script
........
r59368 | georg.brandl | 2007-12-05 21:03:57 +0100 (Wed, 05 Dec 2007) | 2 lines
Another markup fix.
........
r59369 | ronald.oussoren | 2007-12-05 21:07:36 +0100 (Wed, 05 Dec 2007) | 7 lines
This "fixes" compilation issues for the Carbon._OSA module on OSX Leopard
by purging bindings to OSA's debug API's. Those APIs we're completely
unsupported on OSX 10.4 and are no longer available on OSX 10.5.
Note that this patches a generated file. This is somewhat acceptable because
regenerating the file is non-trivial and wouldn't use system headers anyway.
........
r59370 | christian.heimes | 2007-12-05 21:10:38 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed bug #1557 by using popen.communicate() before popen.wait()
........
2007-12-05 16:18:38 -04:00
|
|
|
return tuple()[0]
|
2009-01-03 17:18:54 -04:00
|
|
|
|
Merged revisions 59333-59370 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59343 | georg.brandl | 2007-12-05 08:02:47 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix typo.
........
r59347 | christian.heimes | 2007-12-05 13:31:44 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed quoting and paths in the sqlite project file
........
r59348 | christian.heimes | 2007-12-05 13:45:11 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed error in regrtest. I must have missed the spot.
........
r59350 | christian.heimes | 2007-12-05 13:49:14 +0100 (Wed, 05 Dec 2007) | 1 line
merge -r59315:59316 from py3k: Fix issue #1553: An errornous __length_hint__ can make list() raise a SystemError
........
r59352 | christian.heimes | 2007-12-05 13:52:34 +0100 (Wed, 05 Dec 2007) | 1 line
Added msg to Misc/NEWS
........
r59354 | andrew.kuchling | 2007-12-05 14:27:20 +0100 (Wed, 05 Dec 2007) | 1 line
Spelling fix
........
r59356 | georg.brandl | 2007-12-05 18:56:50 +0100 (Wed, 05 Dec 2007) | 3 lines
Add examples to csv, pprint and traceback docs.
Written by Ross for GHOP.
........
r59358 | raymond.hettinger | 2007-12-05 19:11:08 +0100 (Wed, 05 Dec 2007) | 1 line
Error checking was too aggressive (reported by Chris Tismer)
........
r59359 | georg.brandl | 2007-12-05 19:30:48 +0100 (Wed, 05 Dec 2007) | 2 lines
Add examples to re docs. Written for GHOP by Dan Finnie.
........
r59366 | georg.brandl | 2007-12-05 20:49:21 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix markup.
........
r59367 | christian.heimes | 2007-12-05 20:57:54 +0100 (Wed, 05 Dec 2007) | 1 line
Updated documentation and build_tkinter.py script
........
r59368 | georg.brandl | 2007-12-05 21:03:57 +0100 (Wed, 05 Dec 2007) | 2 lines
Another markup fix.
........
r59369 | ronald.oussoren | 2007-12-05 21:07:36 +0100 (Wed, 05 Dec 2007) | 7 lines
This "fixes" compilation issues for the Carbon._OSA module on OSX Leopard
by purging bindings to OSA's debug API's. Those APIs we're completely
unsupported on OSX 10.4 and are no longer available on OSX 10.5.
Note that this patches a generated file. This is somewhat acceptable because
regenerating the file is non-trivial and wouldn't use system headers anyway.
........
r59370 | christian.heimes | 2007-12-05 21:10:38 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed bug #1557 by using popen.communicate() before popen.wait()
........
2007-12-05 16:18:38 -04:00
|
|
|
try:
|
|
|
|
lumberjack()
|
2010-03-12 21:28:34 -04:00
|
|
|
except IndexError:
|
2023-02-20 17:54:19 -04:00
|
|
|
exc = sys.exception()
|
2008-02-01 07:56:49 -04:00
|
|
|
print("*** print_tb:")
|
2023-02-20 17:54:19 -04:00
|
|
|
traceback.print_tb(exc.__traceback__, limit=1, file=sys.stdout)
|
2008-02-01 07:56:49 -04:00
|
|
|
print("*** print_exception:")
|
2023-02-20 17:54:19 -04:00
|
|
|
traceback.print_exception(exc, limit=2, file=sys.stdout)
|
2008-02-01 07:56:49 -04:00
|
|
|
print("*** print_exc:")
|
2016-08-10 02:35:27 -03:00
|
|
|
traceback.print_exc(limit=2, file=sys.stdout)
|
2008-02-01 07:56:49 -04:00
|
|
|
print("*** format_exc, first and last line:")
|
Merged revisions 59333-59370 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59343 | georg.brandl | 2007-12-05 08:02:47 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix typo.
........
r59347 | christian.heimes | 2007-12-05 13:31:44 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed quoting and paths in the sqlite project file
........
r59348 | christian.heimes | 2007-12-05 13:45:11 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed error in regrtest. I must have missed the spot.
........
r59350 | christian.heimes | 2007-12-05 13:49:14 +0100 (Wed, 05 Dec 2007) | 1 line
merge -r59315:59316 from py3k: Fix issue #1553: An errornous __length_hint__ can make list() raise a SystemError
........
r59352 | christian.heimes | 2007-12-05 13:52:34 +0100 (Wed, 05 Dec 2007) | 1 line
Added msg to Misc/NEWS
........
r59354 | andrew.kuchling | 2007-12-05 14:27:20 +0100 (Wed, 05 Dec 2007) | 1 line
Spelling fix
........
r59356 | georg.brandl | 2007-12-05 18:56:50 +0100 (Wed, 05 Dec 2007) | 3 lines
Add examples to csv, pprint and traceback docs.
Written by Ross for GHOP.
........
r59358 | raymond.hettinger | 2007-12-05 19:11:08 +0100 (Wed, 05 Dec 2007) | 1 line
Error checking was too aggressive (reported by Chris Tismer)
........
r59359 | georg.brandl | 2007-12-05 19:30:48 +0100 (Wed, 05 Dec 2007) | 2 lines
Add examples to re docs. Written for GHOP by Dan Finnie.
........
r59366 | georg.brandl | 2007-12-05 20:49:21 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix markup.
........
r59367 | christian.heimes | 2007-12-05 20:57:54 +0100 (Wed, 05 Dec 2007) | 1 line
Updated documentation and build_tkinter.py script
........
r59368 | georg.brandl | 2007-12-05 21:03:57 +0100 (Wed, 05 Dec 2007) | 2 lines
Another markup fix.
........
r59369 | ronald.oussoren | 2007-12-05 21:07:36 +0100 (Wed, 05 Dec 2007) | 7 lines
This "fixes" compilation issues for the Carbon._OSA module on OSX Leopard
by purging bindings to OSA's debug API's. Those APIs we're completely
unsupported on OSX 10.4 and are no longer available on OSX 10.5.
Note that this patches a generated file. This is somewhat acceptable because
regenerating the file is non-trivial and wouldn't use system headers anyway.
........
r59370 | christian.heimes | 2007-12-05 21:10:38 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed bug #1557 by using popen.communicate() before popen.wait()
........
2007-12-05 16:18:38 -04:00
|
|
|
formatted_lines = traceback.format_exc().splitlines()
|
2008-02-01 07:56:49 -04:00
|
|
|
print(formatted_lines[0])
|
|
|
|
print(formatted_lines[-1])
|
|
|
|
print("*** format_exception:")
|
2023-02-20 17:54:19 -04:00
|
|
|
print(repr(traceback.format_exception(exc)))
|
2008-02-01 07:56:49 -04:00
|
|
|
print("*** extract_tb:")
|
2023-02-20 17:54:19 -04:00
|
|
|
print(repr(traceback.extract_tb(exc.__traceback__)))
|
2008-02-01 07:56:49 -04:00
|
|
|
print("*** format_tb:")
|
2023-02-20 17:54:19 -04:00
|
|
|
print(repr(traceback.format_tb(exc.__traceback__)))
|
|
|
|
print("*** tb_lineno:", exc.__traceback__.tb_lineno)
|
Merged revisions 59333-59370 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59343 | georg.brandl | 2007-12-05 08:02:47 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix typo.
........
r59347 | christian.heimes | 2007-12-05 13:31:44 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed quoting and paths in the sqlite project file
........
r59348 | christian.heimes | 2007-12-05 13:45:11 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed error in regrtest. I must have missed the spot.
........
r59350 | christian.heimes | 2007-12-05 13:49:14 +0100 (Wed, 05 Dec 2007) | 1 line
merge -r59315:59316 from py3k: Fix issue #1553: An errornous __length_hint__ can make list() raise a SystemError
........
r59352 | christian.heimes | 2007-12-05 13:52:34 +0100 (Wed, 05 Dec 2007) | 1 line
Added msg to Misc/NEWS
........
r59354 | andrew.kuchling | 2007-12-05 14:27:20 +0100 (Wed, 05 Dec 2007) | 1 line
Spelling fix
........
r59356 | georg.brandl | 2007-12-05 18:56:50 +0100 (Wed, 05 Dec 2007) | 3 lines
Add examples to csv, pprint and traceback docs.
Written by Ross for GHOP.
........
r59358 | raymond.hettinger | 2007-12-05 19:11:08 +0100 (Wed, 05 Dec 2007) | 1 line
Error checking was too aggressive (reported by Chris Tismer)
........
r59359 | georg.brandl | 2007-12-05 19:30:48 +0100 (Wed, 05 Dec 2007) | 2 lines
Add examples to re docs. Written for GHOP by Dan Finnie.
........
r59366 | georg.brandl | 2007-12-05 20:49:21 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix markup.
........
r59367 | christian.heimes | 2007-12-05 20:57:54 +0100 (Wed, 05 Dec 2007) | 1 line
Updated documentation and build_tkinter.py script
........
r59368 | georg.brandl | 2007-12-05 21:03:57 +0100 (Wed, 05 Dec 2007) | 2 lines
Another markup fix.
........
r59369 | ronald.oussoren | 2007-12-05 21:07:36 +0100 (Wed, 05 Dec 2007) | 7 lines
This "fixes" compilation issues for the Carbon._OSA module on OSX Leopard
by purging bindings to OSA's debug API's. Those APIs we're completely
unsupported on OSX 10.4 and are no longer available on OSX 10.5.
Note that this patches a generated file. This is somewhat acceptable because
regenerating the file is non-trivial and wouldn't use system headers anyway.
........
r59370 | christian.heimes | 2007-12-05 21:10:38 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed bug #1557 by using popen.communicate() before popen.wait()
........
2007-12-05 16:18:38 -04:00
|
|
|
|
2009-04-27 15:38:19 -03:00
|
|
|
The output for the example would look similar to this:
|
Merged revisions 59333-59370 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59343 | georg.brandl | 2007-12-05 08:02:47 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix typo.
........
r59347 | christian.heimes | 2007-12-05 13:31:44 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed quoting and paths in the sqlite project file
........
r59348 | christian.heimes | 2007-12-05 13:45:11 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed error in regrtest. I must have missed the spot.
........
r59350 | christian.heimes | 2007-12-05 13:49:14 +0100 (Wed, 05 Dec 2007) | 1 line
merge -r59315:59316 from py3k: Fix issue #1553: An errornous __length_hint__ can make list() raise a SystemError
........
r59352 | christian.heimes | 2007-12-05 13:52:34 +0100 (Wed, 05 Dec 2007) | 1 line
Added msg to Misc/NEWS
........
r59354 | andrew.kuchling | 2007-12-05 14:27:20 +0100 (Wed, 05 Dec 2007) | 1 line
Spelling fix
........
r59356 | georg.brandl | 2007-12-05 18:56:50 +0100 (Wed, 05 Dec 2007) | 3 lines
Add examples to csv, pprint and traceback docs.
Written by Ross for GHOP.
........
r59358 | raymond.hettinger | 2007-12-05 19:11:08 +0100 (Wed, 05 Dec 2007) | 1 line
Error checking was too aggressive (reported by Chris Tismer)
........
r59359 | georg.brandl | 2007-12-05 19:30:48 +0100 (Wed, 05 Dec 2007) | 2 lines
Add examples to re docs. Written for GHOP by Dan Finnie.
........
r59366 | georg.brandl | 2007-12-05 20:49:21 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix markup.
........
r59367 | christian.heimes | 2007-12-05 20:57:54 +0100 (Wed, 05 Dec 2007) | 1 line
Updated documentation and build_tkinter.py script
........
r59368 | georg.brandl | 2007-12-05 21:03:57 +0100 (Wed, 05 Dec 2007) | 2 lines
Another markup fix.
........
r59369 | ronald.oussoren | 2007-12-05 21:07:36 +0100 (Wed, 05 Dec 2007) | 7 lines
This "fixes" compilation issues for the Carbon._OSA module on OSX Leopard
by purging bindings to OSA's debug API's. Those APIs we're completely
unsupported on OSX 10.4 and are no longer available on OSX 10.5.
Note that this patches a generated file. This is somewhat acceptable because
regenerating the file is non-trivial and wouldn't use system headers anyway.
........
r59370 | christian.heimes | 2007-12-05 21:10:38 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed bug #1557 by using popen.communicate() before popen.wait()
........
2007-12-05 16:18:38 -04:00
|
|
|
|
2009-04-27 15:38:19 -03:00
|
|
|
.. testoutput::
|
|
|
|
:options: +NORMALIZE_WHITESPACE
|
Merged revisions 59333-59370 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59343 | georg.brandl | 2007-12-05 08:02:47 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix typo.
........
r59347 | christian.heimes | 2007-12-05 13:31:44 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed quoting and paths in the sqlite project file
........
r59348 | christian.heimes | 2007-12-05 13:45:11 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed error in regrtest. I must have missed the spot.
........
r59350 | christian.heimes | 2007-12-05 13:49:14 +0100 (Wed, 05 Dec 2007) | 1 line
merge -r59315:59316 from py3k: Fix issue #1553: An errornous __length_hint__ can make list() raise a SystemError
........
r59352 | christian.heimes | 2007-12-05 13:52:34 +0100 (Wed, 05 Dec 2007) | 1 line
Added msg to Misc/NEWS
........
r59354 | andrew.kuchling | 2007-12-05 14:27:20 +0100 (Wed, 05 Dec 2007) | 1 line
Spelling fix
........
r59356 | georg.brandl | 2007-12-05 18:56:50 +0100 (Wed, 05 Dec 2007) | 3 lines
Add examples to csv, pprint and traceback docs.
Written by Ross for GHOP.
........
r59358 | raymond.hettinger | 2007-12-05 19:11:08 +0100 (Wed, 05 Dec 2007) | 1 line
Error checking was too aggressive (reported by Chris Tismer)
........
r59359 | georg.brandl | 2007-12-05 19:30:48 +0100 (Wed, 05 Dec 2007) | 2 lines
Add examples to re docs. Written for GHOP by Dan Finnie.
........
r59366 | georg.brandl | 2007-12-05 20:49:21 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix markup.
........
r59367 | christian.heimes | 2007-12-05 20:57:54 +0100 (Wed, 05 Dec 2007) | 1 line
Updated documentation and build_tkinter.py script
........
r59368 | georg.brandl | 2007-12-05 21:03:57 +0100 (Wed, 05 Dec 2007) | 2 lines
Another markup fix.
........
r59369 | ronald.oussoren | 2007-12-05 21:07:36 +0100 (Wed, 05 Dec 2007) | 7 lines
This "fixes" compilation issues for the Carbon._OSA module on OSX Leopard
by purging bindings to OSA's debug API's. Those APIs we're completely
unsupported on OSX 10.4 and are no longer available on OSX 10.5.
Note that this patches a generated file. This is somewhat acceptable because
regenerating the file is non-trivial and wouldn't use system headers anyway.
........
r59370 | christian.heimes | 2007-12-05 21:10:38 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed bug #1557 by using popen.communicate() before popen.wait()
........
2007-12-05 16:18:38 -04:00
|
|
|
|
|
|
|
*** print_tb:
|
2009-04-27 15:38:19 -03:00
|
|
|
File "<doctest...>", line 10, in <module>
|
Merged revisions 59333-59370 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59343 | georg.brandl | 2007-12-05 08:02:47 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix typo.
........
r59347 | christian.heimes | 2007-12-05 13:31:44 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed quoting and paths in the sqlite project file
........
r59348 | christian.heimes | 2007-12-05 13:45:11 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed error in regrtest. I must have missed the spot.
........
r59350 | christian.heimes | 2007-12-05 13:49:14 +0100 (Wed, 05 Dec 2007) | 1 line
merge -r59315:59316 from py3k: Fix issue #1553: An errornous __length_hint__ can make list() raise a SystemError
........
r59352 | christian.heimes | 2007-12-05 13:52:34 +0100 (Wed, 05 Dec 2007) | 1 line
Added msg to Misc/NEWS
........
r59354 | andrew.kuchling | 2007-12-05 14:27:20 +0100 (Wed, 05 Dec 2007) | 1 line
Spelling fix
........
r59356 | georg.brandl | 2007-12-05 18:56:50 +0100 (Wed, 05 Dec 2007) | 3 lines
Add examples to csv, pprint and traceback docs.
Written by Ross for GHOP.
........
r59358 | raymond.hettinger | 2007-12-05 19:11:08 +0100 (Wed, 05 Dec 2007) | 1 line
Error checking was too aggressive (reported by Chris Tismer)
........
r59359 | georg.brandl | 2007-12-05 19:30:48 +0100 (Wed, 05 Dec 2007) | 2 lines
Add examples to re docs. Written for GHOP by Dan Finnie.
........
r59366 | georg.brandl | 2007-12-05 20:49:21 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix markup.
........
r59367 | christian.heimes | 2007-12-05 20:57:54 +0100 (Wed, 05 Dec 2007) | 1 line
Updated documentation and build_tkinter.py script
........
r59368 | georg.brandl | 2007-12-05 21:03:57 +0100 (Wed, 05 Dec 2007) | 2 lines
Another markup fix.
........
r59369 | ronald.oussoren | 2007-12-05 21:07:36 +0100 (Wed, 05 Dec 2007) | 7 lines
This "fixes" compilation issues for the Carbon._OSA module on OSX Leopard
by purging bindings to OSA's debug API's. Those APIs we're completely
unsupported on OSX 10.4 and are no longer available on OSX 10.5.
Note that this patches a generated file. This is somewhat acceptable because
regenerating the file is non-trivial and wouldn't use system headers anyway.
........
r59370 | christian.heimes | 2007-12-05 21:10:38 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed bug #1557 by using popen.communicate() before popen.wait()
........
2007-12-05 16:18:38 -04:00
|
|
|
lumberjack()
|
|
|
|
*** print_exception:
|
|
|
|
Traceback (most recent call last):
|
2009-04-27 15:38:19 -03:00
|
|
|
File "<doctest...>", line 10, in <module>
|
Merged revisions 59333-59370 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59343 | georg.brandl | 2007-12-05 08:02:47 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix typo.
........
r59347 | christian.heimes | 2007-12-05 13:31:44 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed quoting and paths in the sqlite project file
........
r59348 | christian.heimes | 2007-12-05 13:45:11 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed error in regrtest. I must have missed the spot.
........
r59350 | christian.heimes | 2007-12-05 13:49:14 +0100 (Wed, 05 Dec 2007) | 1 line
merge -r59315:59316 from py3k: Fix issue #1553: An errornous __length_hint__ can make list() raise a SystemError
........
r59352 | christian.heimes | 2007-12-05 13:52:34 +0100 (Wed, 05 Dec 2007) | 1 line
Added msg to Misc/NEWS
........
r59354 | andrew.kuchling | 2007-12-05 14:27:20 +0100 (Wed, 05 Dec 2007) | 1 line
Spelling fix
........
r59356 | georg.brandl | 2007-12-05 18:56:50 +0100 (Wed, 05 Dec 2007) | 3 lines
Add examples to csv, pprint and traceback docs.
Written by Ross for GHOP.
........
r59358 | raymond.hettinger | 2007-12-05 19:11:08 +0100 (Wed, 05 Dec 2007) | 1 line
Error checking was too aggressive (reported by Chris Tismer)
........
r59359 | georg.brandl | 2007-12-05 19:30:48 +0100 (Wed, 05 Dec 2007) | 2 lines
Add examples to re docs. Written for GHOP by Dan Finnie.
........
r59366 | georg.brandl | 2007-12-05 20:49:21 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix markup.
........
r59367 | christian.heimes | 2007-12-05 20:57:54 +0100 (Wed, 05 Dec 2007) | 1 line
Updated documentation and build_tkinter.py script
........
r59368 | georg.brandl | 2007-12-05 21:03:57 +0100 (Wed, 05 Dec 2007) | 2 lines
Another markup fix.
........
r59369 | ronald.oussoren | 2007-12-05 21:07:36 +0100 (Wed, 05 Dec 2007) | 7 lines
This "fixes" compilation issues for the Carbon._OSA module on OSX Leopard
by purging bindings to OSA's debug API's. Those APIs we're completely
unsupported on OSX 10.4 and are no longer available on OSX 10.5.
Note that this patches a generated file. This is somewhat acceptable because
regenerating the file is non-trivial and wouldn't use system headers anyway.
........
r59370 | christian.heimes | 2007-12-05 21:10:38 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed bug #1557 by using popen.communicate() before popen.wait()
........
2007-12-05 16:18:38 -04:00
|
|
|
lumberjack()
|
2009-04-27 15:38:19 -03:00
|
|
|
File "<doctest...>", line 4, in lumberjack
|
2022-09-05 18:30:51 -03:00
|
|
|
bright_side_of_life()
|
Merged revisions 59333-59370 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59343 | georg.brandl | 2007-12-05 08:02:47 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix typo.
........
r59347 | christian.heimes | 2007-12-05 13:31:44 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed quoting and paths in the sqlite project file
........
r59348 | christian.heimes | 2007-12-05 13:45:11 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed error in regrtest. I must have missed the spot.
........
r59350 | christian.heimes | 2007-12-05 13:49:14 +0100 (Wed, 05 Dec 2007) | 1 line
merge -r59315:59316 from py3k: Fix issue #1553: An errornous __length_hint__ can make list() raise a SystemError
........
r59352 | christian.heimes | 2007-12-05 13:52:34 +0100 (Wed, 05 Dec 2007) | 1 line
Added msg to Misc/NEWS
........
r59354 | andrew.kuchling | 2007-12-05 14:27:20 +0100 (Wed, 05 Dec 2007) | 1 line
Spelling fix
........
r59356 | georg.brandl | 2007-12-05 18:56:50 +0100 (Wed, 05 Dec 2007) | 3 lines
Add examples to csv, pprint and traceback docs.
Written by Ross for GHOP.
........
r59358 | raymond.hettinger | 2007-12-05 19:11:08 +0100 (Wed, 05 Dec 2007) | 1 line
Error checking was too aggressive (reported by Chris Tismer)
........
r59359 | georg.brandl | 2007-12-05 19:30:48 +0100 (Wed, 05 Dec 2007) | 2 lines
Add examples to re docs. Written for GHOP by Dan Finnie.
........
r59366 | georg.brandl | 2007-12-05 20:49:21 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix markup.
........
r59367 | christian.heimes | 2007-12-05 20:57:54 +0100 (Wed, 05 Dec 2007) | 1 line
Updated documentation and build_tkinter.py script
........
r59368 | georg.brandl | 2007-12-05 21:03:57 +0100 (Wed, 05 Dec 2007) | 2 lines
Another markup fix.
........
r59369 | ronald.oussoren | 2007-12-05 21:07:36 +0100 (Wed, 05 Dec 2007) | 7 lines
This "fixes" compilation issues for the Carbon._OSA module on OSX Leopard
by purging bindings to OSA's debug API's. Those APIs we're completely
unsupported on OSX 10.4 and are no longer available on OSX 10.5.
Note that this patches a generated file. This is somewhat acceptable because
regenerating the file is non-trivial and wouldn't use system headers anyway.
........
r59370 | christian.heimes | 2007-12-05 21:10:38 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed bug #1557 by using popen.communicate() before popen.wait()
........
2007-12-05 16:18:38 -04:00
|
|
|
IndexError: tuple index out of range
|
|
|
|
*** print_exc:
|
|
|
|
Traceback (most recent call last):
|
2009-04-27 15:38:19 -03:00
|
|
|
File "<doctest...>", line 10, in <module>
|
Merged revisions 59333-59370 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59343 | georg.brandl | 2007-12-05 08:02:47 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix typo.
........
r59347 | christian.heimes | 2007-12-05 13:31:44 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed quoting and paths in the sqlite project file
........
r59348 | christian.heimes | 2007-12-05 13:45:11 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed error in regrtest. I must have missed the spot.
........
r59350 | christian.heimes | 2007-12-05 13:49:14 +0100 (Wed, 05 Dec 2007) | 1 line
merge -r59315:59316 from py3k: Fix issue #1553: An errornous __length_hint__ can make list() raise a SystemError
........
r59352 | christian.heimes | 2007-12-05 13:52:34 +0100 (Wed, 05 Dec 2007) | 1 line
Added msg to Misc/NEWS
........
r59354 | andrew.kuchling | 2007-12-05 14:27:20 +0100 (Wed, 05 Dec 2007) | 1 line
Spelling fix
........
r59356 | georg.brandl | 2007-12-05 18:56:50 +0100 (Wed, 05 Dec 2007) | 3 lines
Add examples to csv, pprint and traceback docs.
Written by Ross for GHOP.
........
r59358 | raymond.hettinger | 2007-12-05 19:11:08 +0100 (Wed, 05 Dec 2007) | 1 line
Error checking was too aggressive (reported by Chris Tismer)
........
r59359 | georg.brandl | 2007-12-05 19:30:48 +0100 (Wed, 05 Dec 2007) | 2 lines
Add examples to re docs. Written for GHOP by Dan Finnie.
........
r59366 | georg.brandl | 2007-12-05 20:49:21 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix markup.
........
r59367 | christian.heimes | 2007-12-05 20:57:54 +0100 (Wed, 05 Dec 2007) | 1 line
Updated documentation and build_tkinter.py script
........
r59368 | georg.brandl | 2007-12-05 21:03:57 +0100 (Wed, 05 Dec 2007) | 2 lines
Another markup fix.
........
r59369 | ronald.oussoren | 2007-12-05 21:07:36 +0100 (Wed, 05 Dec 2007) | 7 lines
This "fixes" compilation issues for the Carbon._OSA module on OSX Leopard
by purging bindings to OSA's debug API's. Those APIs we're completely
unsupported on OSX 10.4 and are no longer available on OSX 10.5.
Note that this patches a generated file. This is somewhat acceptable because
regenerating the file is non-trivial and wouldn't use system headers anyway.
........
r59370 | christian.heimes | 2007-12-05 21:10:38 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed bug #1557 by using popen.communicate() before popen.wait()
........
2007-12-05 16:18:38 -04:00
|
|
|
lumberjack()
|
2009-04-27 15:38:19 -03:00
|
|
|
File "<doctest...>", line 4, in lumberjack
|
2022-09-05 18:30:51 -03:00
|
|
|
bright_side_of_life()
|
Merged revisions 59333-59370 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59343 | georg.brandl | 2007-12-05 08:02:47 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix typo.
........
r59347 | christian.heimes | 2007-12-05 13:31:44 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed quoting and paths in the sqlite project file
........
r59348 | christian.heimes | 2007-12-05 13:45:11 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed error in regrtest. I must have missed the spot.
........
r59350 | christian.heimes | 2007-12-05 13:49:14 +0100 (Wed, 05 Dec 2007) | 1 line
merge -r59315:59316 from py3k: Fix issue #1553: An errornous __length_hint__ can make list() raise a SystemError
........
r59352 | christian.heimes | 2007-12-05 13:52:34 +0100 (Wed, 05 Dec 2007) | 1 line
Added msg to Misc/NEWS
........
r59354 | andrew.kuchling | 2007-12-05 14:27:20 +0100 (Wed, 05 Dec 2007) | 1 line
Spelling fix
........
r59356 | georg.brandl | 2007-12-05 18:56:50 +0100 (Wed, 05 Dec 2007) | 3 lines
Add examples to csv, pprint and traceback docs.
Written by Ross for GHOP.
........
r59358 | raymond.hettinger | 2007-12-05 19:11:08 +0100 (Wed, 05 Dec 2007) | 1 line
Error checking was too aggressive (reported by Chris Tismer)
........
r59359 | georg.brandl | 2007-12-05 19:30:48 +0100 (Wed, 05 Dec 2007) | 2 lines
Add examples to re docs. Written for GHOP by Dan Finnie.
........
r59366 | georg.brandl | 2007-12-05 20:49:21 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix markup.
........
r59367 | christian.heimes | 2007-12-05 20:57:54 +0100 (Wed, 05 Dec 2007) | 1 line
Updated documentation and build_tkinter.py script
........
r59368 | georg.brandl | 2007-12-05 21:03:57 +0100 (Wed, 05 Dec 2007) | 2 lines
Another markup fix.
........
r59369 | ronald.oussoren | 2007-12-05 21:07:36 +0100 (Wed, 05 Dec 2007) | 7 lines
This "fixes" compilation issues for the Carbon._OSA module on OSX Leopard
by purging bindings to OSA's debug API's. Those APIs we're completely
unsupported on OSX 10.4 and are no longer available on OSX 10.5.
Note that this patches a generated file. This is somewhat acceptable because
regenerating the file is non-trivial and wouldn't use system headers anyway.
........
r59370 | christian.heimes | 2007-12-05 21:10:38 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed bug #1557 by using popen.communicate() before popen.wait()
........
2007-12-05 16:18:38 -04:00
|
|
|
IndexError: tuple index out of range
|
|
|
|
*** format_exc, first and last line:
|
|
|
|
Traceback (most recent call last):
|
|
|
|
IndexError: tuple index out of range
|
|
|
|
*** format_exception:
|
|
|
|
['Traceback (most recent call last):\n',
|
gh-93883: elide traceback indicators when possible (#93994)
* gh-93883: elide traceback indicators when possible
Elide traceback column indicators when the entire line of the
frame is implicated. This reduces traceback length and draws
even more attention to the remaining (very relevant) indicators.
Example:
```
Traceback (most recent call last):
File "query.py", line 99, in <module>
bar()
File "query.py", line 66, in bar
foo()
File "query.py", line 37, in foo
magic_arithmetic('foo')
File "query.py", line 18, in magic_arithmetic
return add_counts(x) / 25
^^^^^^^^^^^^^
File "query.py", line 24, in add_counts
return 25 + query_user(user1) + query_user(user2)
^^^^^^^^^^^^^^^^^
File "query.py", line 32, in query_user
return 1 + query_count(db, response['a']['b']['c']['user'], retry=True)
~~~~~~~~~~~~~~~~~~^^^^^
TypeError: 'NoneType' object is not subscriptable
```
Rather than going out of our way to provide indicator coverage
in every traceback test suite, the indicator test suite should
be responible for sufficient coverage (e.g. by adding a basic
exception group test to ensure that margin strings are covered).
2022-07-11 03:40:53 -03:00
|
|
|
' File "<doctest default[0]>", line 10, in <module>\n lumberjack()\n',
|
2022-09-05 18:30:51 -03:00
|
|
|
' File "<doctest default[0]>", line 4, in lumberjack\n bright_side_of_life()\n',
|
|
|
|
' File "<doctest default[0]>", line 7, in bright_side_of_life\n return tuple()[0]\n ~~~~~~~^^^\n',
|
Merged revisions 59333-59370 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59343 | georg.brandl | 2007-12-05 08:02:47 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix typo.
........
r59347 | christian.heimes | 2007-12-05 13:31:44 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed quoting and paths in the sqlite project file
........
r59348 | christian.heimes | 2007-12-05 13:45:11 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed error in regrtest. I must have missed the spot.
........
r59350 | christian.heimes | 2007-12-05 13:49:14 +0100 (Wed, 05 Dec 2007) | 1 line
merge -r59315:59316 from py3k: Fix issue #1553: An errornous __length_hint__ can make list() raise a SystemError
........
r59352 | christian.heimes | 2007-12-05 13:52:34 +0100 (Wed, 05 Dec 2007) | 1 line
Added msg to Misc/NEWS
........
r59354 | andrew.kuchling | 2007-12-05 14:27:20 +0100 (Wed, 05 Dec 2007) | 1 line
Spelling fix
........
r59356 | georg.brandl | 2007-12-05 18:56:50 +0100 (Wed, 05 Dec 2007) | 3 lines
Add examples to csv, pprint and traceback docs.
Written by Ross for GHOP.
........
r59358 | raymond.hettinger | 2007-12-05 19:11:08 +0100 (Wed, 05 Dec 2007) | 1 line
Error checking was too aggressive (reported by Chris Tismer)
........
r59359 | georg.brandl | 2007-12-05 19:30:48 +0100 (Wed, 05 Dec 2007) | 2 lines
Add examples to re docs. Written for GHOP by Dan Finnie.
........
r59366 | georg.brandl | 2007-12-05 20:49:21 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix markup.
........
r59367 | christian.heimes | 2007-12-05 20:57:54 +0100 (Wed, 05 Dec 2007) | 1 line
Updated documentation and build_tkinter.py script
........
r59368 | georg.brandl | 2007-12-05 21:03:57 +0100 (Wed, 05 Dec 2007) | 2 lines
Another markup fix.
........
r59369 | ronald.oussoren | 2007-12-05 21:07:36 +0100 (Wed, 05 Dec 2007) | 7 lines
This "fixes" compilation issues for the Carbon._OSA module on OSX Leopard
by purging bindings to OSA's debug API's. Those APIs we're completely
unsupported on OSX 10.4 and are no longer available on OSX 10.5.
Note that this patches a generated file. This is somewhat acceptable because
regenerating the file is non-trivial and wouldn't use system headers anyway.
........
r59370 | christian.heimes | 2007-12-05 21:10:38 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed bug #1557 by using popen.communicate() before popen.wait()
........
2007-12-05 16:18:38 -04:00
|
|
|
'IndexError: tuple index out of range\n']
|
|
|
|
*** extract_tb:
|
2016-08-10 02:35:27 -03:00
|
|
|
[<FrameSummary file <doctest...>, line 10 in <module>>,
|
|
|
|
<FrameSummary file <doctest...>, line 4 in lumberjack>,
|
2022-09-05 18:30:51 -03:00
|
|
|
<FrameSummary file <doctest...>, line 7 in bright_side_of_life>]
|
Merged revisions 59333-59370 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59343 | georg.brandl | 2007-12-05 08:02:47 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix typo.
........
r59347 | christian.heimes | 2007-12-05 13:31:44 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed quoting and paths in the sqlite project file
........
r59348 | christian.heimes | 2007-12-05 13:45:11 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed error in regrtest. I must have missed the spot.
........
r59350 | christian.heimes | 2007-12-05 13:49:14 +0100 (Wed, 05 Dec 2007) | 1 line
merge -r59315:59316 from py3k: Fix issue #1553: An errornous __length_hint__ can make list() raise a SystemError
........
r59352 | christian.heimes | 2007-12-05 13:52:34 +0100 (Wed, 05 Dec 2007) | 1 line
Added msg to Misc/NEWS
........
r59354 | andrew.kuchling | 2007-12-05 14:27:20 +0100 (Wed, 05 Dec 2007) | 1 line
Spelling fix
........
r59356 | georg.brandl | 2007-12-05 18:56:50 +0100 (Wed, 05 Dec 2007) | 3 lines
Add examples to csv, pprint and traceback docs.
Written by Ross for GHOP.
........
r59358 | raymond.hettinger | 2007-12-05 19:11:08 +0100 (Wed, 05 Dec 2007) | 1 line
Error checking was too aggressive (reported by Chris Tismer)
........
r59359 | georg.brandl | 2007-12-05 19:30:48 +0100 (Wed, 05 Dec 2007) | 2 lines
Add examples to re docs. Written for GHOP by Dan Finnie.
........
r59366 | georg.brandl | 2007-12-05 20:49:21 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix markup.
........
r59367 | christian.heimes | 2007-12-05 20:57:54 +0100 (Wed, 05 Dec 2007) | 1 line
Updated documentation and build_tkinter.py script
........
r59368 | georg.brandl | 2007-12-05 21:03:57 +0100 (Wed, 05 Dec 2007) | 2 lines
Another markup fix.
........
r59369 | ronald.oussoren | 2007-12-05 21:07:36 +0100 (Wed, 05 Dec 2007) | 7 lines
This "fixes" compilation issues for the Carbon._OSA module on OSX Leopard
by purging bindings to OSA's debug API's. Those APIs we're completely
unsupported on OSX 10.4 and are no longer available on OSX 10.5.
Note that this patches a generated file. This is somewhat acceptable because
regenerating the file is non-trivial and wouldn't use system headers anyway.
........
r59370 | christian.heimes | 2007-12-05 21:10:38 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed bug #1557 by using popen.communicate() before popen.wait()
........
2007-12-05 16:18:38 -04:00
|
|
|
*** format_tb:
|
gh-93883: elide traceback indicators when possible (#93994)
* gh-93883: elide traceback indicators when possible
Elide traceback column indicators when the entire line of the
frame is implicated. This reduces traceback length and draws
even more attention to the remaining (very relevant) indicators.
Example:
```
Traceback (most recent call last):
File "query.py", line 99, in <module>
bar()
File "query.py", line 66, in bar
foo()
File "query.py", line 37, in foo
magic_arithmetic('foo')
File "query.py", line 18, in magic_arithmetic
return add_counts(x) / 25
^^^^^^^^^^^^^
File "query.py", line 24, in add_counts
return 25 + query_user(user1) + query_user(user2)
^^^^^^^^^^^^^^^^^
File "query.py", line 32, in query_user
return 1 + query_count(db, response['a']['b']['c']['user'], retry=True)
~~~~~~~~~~~~~~~~~~^^^^^
TypeError: 'NoneType' object is not subscriptable
```
Rather than going out of our way to provide indicator coverage
in every traceback test suite, the indicator test suite should
be responible for sufficient coverage (e.g. by adding a basic
exception group test to ensure that margin strings are covered).
2022-07-11 03:40:53 -03:00
|
|
|
[' File "<doctest default[0]>", line 10, in <module>\n lumberjack()\n',
|
2022-09-05 18:30:51 -03:00
|
|
|
' File "<doctest default[0]>", line 4, in lumberjack\n bright_side_of_life()\n',
|
|
|
|
' File "<doctest default[0]>", line 7, in bright_side_of_life\n return tuple()[0]\n ~~~~~~~^^^\n']
|
2009-04-27 15:38:19 -03:00
|
|
|
*** tb_lineno: 10
|
Merged revisions 59333-59370 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59343 | georg.brandl | 2007-12-05 08:02:47 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix typo.
........
r59347 | christian.heimes | 2007-12-05 13:31:44 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed quoting and paths in the sqlite project file
........
r59348 | christian.heimes | 2007-12-05 13:45:11 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed error in regrtest. I must have missed the spot.
........
r59350 | christian.heimes | 2007-12-05 13:49:14 +0100 (Wed, 05 Dec 2007) | 1 line
merge -r59315:59316 from py3k: Fix issue #1553: An errornous __length_hint__ can make list() raise a SystemError
........
r59352 | christian.heimes | 2007-12-05 13:52:34 +0100 (Wed, 05 Dec 2007) | 1 line
Added msg to Misc/NEWS
........
r59354 | andrew.kuchling | 2007-12-05 14:27:20 +0100 (Wed, 05 Dec 2007) | 1 line
Spelling fix
........
r59356 | georg.brandl | 2007-12-05 18:56:50 +0100 (Wed, 05 Dec 2007) | 3 lines
Add examples to csv, pprint and traceback docs.
Written by Ross for GHOP.
........
r59358 | raymond.hettinger | 2007-12-05 19:11:08 +0100 (Wed, 05 Dec 2007) | 1 line
Error checking was too aggressive (reported by Chris Tismer)
........
r59359 | georg.brandl | 2007-12-05 19:30:48 +0100 (Wed, 05 Dec 2007) | 2 lines
Add examples to re docs. Written for GHOP by Dan Finnie.
........
r59366 | georg.brandl | 2007-12-05 20:49:21 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix markup.
........
r59367 | christian.heimes | 2007-12-05 20:57:54 +0100 (Wed, 05 Dec 2007) | 1 line
Updated documentation and build_tkinter.py script
........
r59368 | georg.brandl | 2007-12-05 21:03:57 +0100 (Wed, 05 Dec 2007) | 2 lines
Another markup fix.
........
r59369 | ronald.oussoren | 2007-12-05 21:07:36 +0100 (Wed, 05 Dec 2007) | 7 lines
This "fixes" compilation issues for the Carbon._OSA module on OSX Leopard
by purging bindings to OSA's debug API's. Those APIs we're completely
unsupported on OSX 10.4 and are no longer available on OSX 10.5.
Note that this patches a generated file. This is somewhat acceptable because
regenerating the file is non-trivial and wouldn't use system headers anyway.
........
r59370 | christian.heimes | 2007-12-05 21:10:38 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed bug #1557 by using popen.communicate() before popen.wait()
........
2007-12-05 16:18:38 -04:00
|
|
|
|
|
|
|
|
|
|
|
The following example shows the different ways to print and format the stack::
|
|
|
|
|
|
|
|
>>> import traceback
|
|
|
|
>>> def another_function():
|
|
|
|
... lumberstack()
|
2009-01-03 17:18:54 -04:00
|
|
|
...
|
Merged revisions 59333-59370 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59343 | georg.brandl | 2007-12-05 08:02:47 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix typo.
........
r59347 | christian.heimes | 2007-12-05 13:31:44 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed quoting and paths in the sqlite project file
........
r59348 | christian.heimes | 2007-12-05 13:45:11 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed error in regrtest. I must have missed the spot.
........
r59350 | christian.heimes | 2007-12-05 13:49:14 +0100 (Wed, 05 Dec 2007) | 1 line
merge -r59315:59316 from py3k: Fix issue #1553: An errornous __length_hint__ can make list() raise a SystemError
........
r59352 | christian.heimes | 2007-12-05 13:52:34 +0100 (Wed, 05 Dec 2007) | 1 line
Added msg to Misc/NEWS
........
r59354 | andrew.kuchling | 2007-12-05 14:27:20 +0100 (Wed, 05 Dec 2007) | 1 line
Spelling fix
........
r59356 | georg.brandl | 2007-12-05 18:56:50 +0100 (Wed, 05 Dec 2007) | 3 lines
Add examples to csv, pprint and traceback docs.
Written by Ross for GHOP.
........
r59358 | raymond.hettinger | 2007-12-05 19:11:08 +0100 (Wed, 05 Dec 2007) | 1 line
Error checking was too aggressive (reported by Chris Tismer)
........
r59359 | georg.brandl | 2007-12-05 19:30:48 +0100 (Wed, 05 Dec 2007) | 2 lines
Add examples to re docs. Written for GHOP by Dan Finnie.
........
r59366 | georg.brandl | 2007-12-05 20:49:21 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix markup.
........
r59367 | christian.heimes | 2007-12-05 20:57:54 +0100 (Wed, 05 Dec 2007) | 1 line
Updated documentation and build_tkinter.py script
........
r59368 | georg.brandl | 2007-12-05 21:03:57 +0100 (Wed, 05 Dec 2007) | 2 lines
Another markup fix.
........
r59369 | ronald.oussoren | 2007-12-05 21:07:36 +0100 (Wed, 05 Dec 2007) | 7 lines
This "fixes" compilation issues for the Carbon._OSA module on OSX Leopard
by purging bindings to OSA's debug API's. Those APIs we're completely
unsupported on OSX 10.4 and are no longer available on OSX 10.5.
Note that this patches a generated file. This is somewhat acceptable because
regenerating the file is non-trivial and wouldn't use system headers anyway.
........
r59370 | christian.heimes | 2007-12-05 21:10:38 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed bug #1557 by using popen.communicate() before popen.wait()
........
2007-12-05 16:18:38 -04:00
|
|
|
>>> def lumberstack():
|
|
|
|
... traceback.print_stack()
|
2008-02-01 07:56:49 -04:00
|
|
|
... print(repr(traceback.extract_stack()))
|
|
|
|
... print(repr(traceback.format_stack()))
|
2009-01-03 17:18:54 -04:00
|
|
|
...
|
Merged revisions 59333-59370 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59343 | georg.brandl | 2007-12-05 08:02:47 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix typo.
........
r59347 | christian.heimes | 2007-12-05 13:31:44 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed quoting and paths in the sqlite project file
........
r59348 | christian.heimes | 2007-12-05 13:45:11 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed error in regrtest. I must have missed the spot.
........
r59350 | christian.heimes | 2007-12-05 13:49:14 +0100 (Wed, 05 Dec 2007) | 1 line
merge -r59315:59316 from py3k: Fix issue #1553: An errornous __length_hint__ can make list() raise a SystemError
........
r59352 | christian.heimes | 2007-12-05 13:52:34 +0100 (Wed, 05 Dec 2007) | 1 line
Added msg to Misc/NEWS
........
r59354 | andrew.kuchling | 2007-12-05 14:27:20 +0100 (Wed, 05 Dec 2007) | 1 line
Spelling fix
........
r59356 | georg.brandl | 2007-12-05 18:56:50 +0100 (Wed, 05 Dec 2007) | 3 lines
Add examples to csv, pprint and traceback docs.
Written by Ross for GHOP.
........
r59358 | raymond.hettinger | 2007-12-05 19:11:08 +0100 (Wed, 05 Dec 2007) | 1 line
Error checking was too aggressive (reported by Chris Tismer)
........
r59359 | georg.brandl | 2007-12-05 19:30:48 +0100 (Wed, 05 Dec 2007) | 2 lines
Add examples to re docs. Written for GHOP by Dan Finnie.
........
r59366 | georg.brandl | 2007-12-05 20:49:21 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix markup.
........
r59367 | christian.heimes | 2007-12-05 20:57:54 +0100 (Wed, 05 Dec 2007) | 1 line
Updated documentation and build_tkinter.py script
........
r59368 | georg.brandl | 2007-12-05 21:03:57 +0100 (Wed, 05 Dec 2007) | 2 lines
Another markup fix.
........
r59369 | ronald.oussoren | 2007-12-05 21:07:36 +0100 (Wed, 05 Dec 2007) | 7 lines
This "fixes" compilation issues for the Carbon._OSA module on OSX Leopard
by purging bindings to OSA's debug API's. Those APIs we're completely
unsupported on OSX 10.4 and are no longer available on OSX 10.5.
Note that this patches a generated file. This is somewhat acceptable because
regenerating the file is non-trivial and wouldn't use system headers anyway.
........
r59370 | christian.heimes | 2007-12-05 21:10:38 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed bug #1557 by using popen.communicate() before popen.wait()
........
2007-12-05 16:18:38 -04:00
|
|
|
>>> another_function()
|
|
|
|
File "<doctest>", line 10, in <module>
|
|
|
|
another_function()
|
|
|
|
File "<doctest>", line 3, in another_function
|
|
|
|
lumberstack()
|
|
|
|
File "<doctest>", line 6, in lumberstack
|
|
|
|
traceback.print_stack()
|
|
|
|
[('<doctest>', 10, '<module>', 'another_function()'),
|
|
|
|
('<doctest>', 3, 'another_function', 'lumberstack()'),
|
2008-02-01 07:56:49 -04:00
|
|
|
('<doctest>', 7, 'lumberstack', 'print(repr(traceback.extract_stack()))')]
|
Merged revisions 59333-59370 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59343 | georg.brandl | 2007-12-05 08:02:47 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix typo.
........
r59347 | christian.heimes | 2007-12-05 13:31:44 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed quoting and paths in the sqlite project file
........
r59348 | christian.heimes | 2007-12-05 13:45:11 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed error in regrtest. I must have missed the spot.
........
r59350 | christian.heimes | 2007-12-05 13:49:14 +0100 (Wed, 05 Dec 2007) | 1 line
merge -r59315:59316 from py3k: Fix issue #1553: An errornous __length_hint__ can make list() raise a SystemError
........
r59352 | christian.heimes | 2007-12-05 13:52:34 +0100 (Wed, 05 Dec 2007) | 1 line
Added msg to Misc/NEWS
........
r59354 | andrew.kuchling | 2007-12-05 14:27:20 +0100 (Wed, 05 Dec 2007) | 1 line
Spelling fix
........
r59356 | georg.brandl | 2007-12-05 18:56:50 +0100 (Wed, 05 Dec 2007) | 3 lines
Add examples to csv, pprint and traceback docs.
Written by Ross for GHOP.
........
r59358 | raymond.hettinger | 2007-12-05 19:11:08 +0100 (Wed, 05 Dec 2007) | 1 line
Error checking was too aggressive (reported by Chris Tismer)
........
r59359 | georg.brandl | 2007-12-05 19:30:48 +0100 (Wed, 05 Dec 2007) | 2 lines
Add examples to re docs. Written for GHOP by Dan Finnie.
........
r59366 | georg.brandl | 2007-12-05 20:49:21 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix markup.
........
r59367 | christian.heimes | 2007-12-05 20:57:54 +0100 (Wed, 05 Dec 2007) | 1 line
Updated documentation and build_tkinter.py script
........
r59368 | georg.brandl | 2007-12-05 21:03:57 +0100 (Wed, 05 Dec 2007) | 2 lines
Another markup fix.
........
r59369 | ronald.oussoren | 2007-12-05 21:07:36 +0100 (Wed, 05 Dec 2007) | 7 lines
This "fixes" compilation issues for the Carbon._OSA module on OSX Leopard
by purging bindings to OSA's debug API's. Those APIs we're completely
unsupported on OSX 10.4 and are no longer available on OSX 10.5.
Note that this patches a generated file. This is somewhat acceptable because
regenerating the file is non-trivial and wouldn't use system headers anyway.
........
r59370 | christian.heimes | 2007-12-05 21:10:38 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed bug #1557 by using popen.communicate() before popen.wait()
........
2007-12-05 16:18:38 -04:00
|
|
|
[' File "<doctest>", line 10, in <module>\n another_function()\n',
|
|
|
|
' File "<doctest>", line 3, in another_function\n lumberstack()\n',
|
2008-02-01 07:56:49 -04:00
|
|
|
' File "<doctest>", line 8, in lumberstack\n print(repr(traceback.format_stack()))\n']
|
Merged revisions 59333-59370 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59343 | georg.brandl | 2007-12-05 08:02:47 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix typo.
........
r59347 | christian.heimes | 2007-12-05 13:31:44 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed quoting and paths in the sqlite project file
........
r59348 | christian.heimes | 2007-12-05 13:45:11 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed error in regrtest. I must have missed the spot.
........
r59350 | christian.heimes | 2007-12-05 13:49:14 +0100 (Wed, 05 Dec 2007) | 1 line
merge -r59315:59316 from py3k: Fix issue #1553: An errornous __length_hint__ can make list() raise a SystemError
........
r59352 | christian.heimes | 2007-12-05 13:52:34 +0100 (Wed, 05 Dec 2007) | 1 line
Added msg to Misc/NEWS
........
r59354 | andrew.kuchling | 2007-12-05 14:27:20 +0100 (Wed, 05 Dec 2007) | 1 line
Spelling fix
........
r59356 | georg.brandl | 2007-12-05 18:56:50 +0100 (Wed, 05 Dec 2007) | 3 lines
Add examples to csv, pprint and traceback docs.
Written by Ross for GHOP.
........
r59358 | raymond.hettinger | 2007-12-05 19:11:08 +0100 (Wed, 05 Dec 2007) | 1 line
Error checking was too aggressive (reported by Chris Tismer)
........
r59359 | georg.brandl | 2007-12-05 19:30:48 +0100 (Wed, 05 Dec 2007) | 2 lines
Add examples to re docs. Written for GHOP by Dan Finnie.
........
r59366 | georg.brandl | 2007-12-05 20:49:21 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix markup.
........
r59367 | christian.heimes | 2007-12-05 20:57:54 +0100 (Wed, 05 Dec 2007) | 1 line
Updated documentation and build_tkinter.py script
........
r59368 | georg.brandl | 2007-12-05 21:03:57 +0100 (Wed, 05 Dec 2007) | 2 lines
Another markup fix.
........
r59369 | ronald.oussoren | 2007-12-05 21:07:36 +0100 (Wed, 05 Dec 2007) | 7 lines
This "fixes" compilation issues for the Carbon._OSA module on OSX Leopard
by purging bindings to OSA's debug API's. Those APIs we're completely
unsupported on OSX 10.4 and are no longer available on OSX 10.5.
Note that this patches a generated file. This is somewhat acceptable because
regenerating the file is non-trivial and wouldn't use system headers anyway.
........
r59370 | christian.heimes | 2007-12-05 21:10:38 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed bug #1557 by using popen.communicate() before popen.wait()
........
2007-12-05 16:18:38 -04:00
|
|
|
|
|
|
|
|
2009-04-27 15:38:19 -03:00
|
|
|
This last example demonstrates the final few formatting functions:
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
:options: +NORMALIZE_WHITESPACE
|
Merged revisions 59333-59370 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59343 | georg.brandl | 2007-12-05 08:02:47 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix typo.
........
r59347 | christian.heimes | 2007-12-05 13:31:44 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed quoting and paths in the sqlite project file
........
r59348 | christian.heimes | 2007-12-05 13:45:11 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed error in regrtest. I must have missed the spot.
........
r59350 | christian.heimes | 2007-12-05 13:49:14 +0100 (Wed, 05 Dec 2007) | 1 line
merge -r59315:59316 from py3k: Fix issue #1553: An errornous __length_hint__ can make list() raise a SystemError
........
r59352 | christian.heimes | 2007-12-05 13:52:34 +0100 (Wed, 05 Dec 2007) | 1 line
Added msg to Misc/NEWS
........
r59354 | andrew.kuchling | 2007-12-05 14:27:20 +0100 (Wed, 05 Dec 2007) | 1 line
Spelling fix
........
r59356 | georg.brandl | 2007-12-05 18:56:50 +0100 (Wed, 05 Dec 2007) | 3 lines
Add examples to csv, pprint and traceback docs.
Written by Ross for GHOP.
........
r59358 | raymond.hettinger | 2007-12-05 19:11:08 +0100 (Wed, 05 Dec 2007) | 1 line
Error checking was too aggressive (reported by Chris Tismer)
........
r59359 | georg.brandl | 2007-12-05 19:30:48 +0100 (Wed, 05 Dec 2007) | 2 lines
Add examples to re docs. Written for GHOP by Dan Finnie.
........
r59366 | georg.brandl | 2007-12-05 20:49:21 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix markup.
........
r59367 | christian.heimes | 2007-12-05 20:57:54 +0100 (Wed, 05 Dec 2007) | 1 line
Updated documentation and build_tkinter.py script
........
r59368 | georg.brandl | 2007-12-05 21:03:57 +0100 (Wed, 05 Dec 2007) | 2 lines
Another markup fix.
........
r59369 | ronald.oussoren | 2007-12-05 21:07:36 +0100 (Wed, 05 Dec 2007) | 7 lines
This "fixes" compilation issues for the Carbon._OSA module on OSX Leopard
by purging bindings to OSA's debug API's. Those APIs we're completely
unsupported on OSX 10.4 and are no longer available on OSX 10.5.
Note that this patches a generated file. This is somewhat acceptable because
regenerating the file is non-trivial and wouldn't use system headers anyway.
........
r59370 | christian.heimes | 2007-12-05 21:10:38 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed bug #1557 by using popen.communicate() before popen.wait()
........
2007-12-05 16:18:38 -04:00
|
|
|
|
|
|
|
>>> import traceback
|
2009-04-27 13:22:44 -03:00
|
|
|
>>> traceback.format_list([('spam.py', 3, '<module>', 'spam.eggs()'),
|
|
|
|
... ('eggs.py', 42, 'eggs', 'return "bacon"')])
|
Merged revisions 59333-59370 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59343 | georg.brandl | 2007-12-05 08:02:47 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix typo.
........
r59347 | christian.heimes | 2007-12-05 13:31:44 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed quoting and paths in the sqlite project file
........
r59348 | christian.heimes | 2007-12-05 13:45:11 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed error in regrtest. I must have missed the spot.
........
r59350 | christian.heimes | 2007-12-05 13:49:14 +0100 (Wed, 05 Dec 2007) | 1 line
merge -r59315:59316 from py3k: Fix issue #1553: An errornous __length_hint__ can make list() raise a SystemError
........
r59352 | christian.heimes | 2007-12-05 13:52:34 +0100 (Wed, 05 Dec 2007) | 1 line
Added msg to Misc/NEWS
........
r59354 | andrew.kuchling | 2007-12-05 14:27:20 +0100 (Wed, 05 Dec 2007) | 1 line
Spelling fix
........
r59356 | georg.brandl | 2007-12-05 18:56:50 +0100 (Wed, 05 Dec 2007) | 3 lines
Add examples to csv, pprint and traceback docs.
Written by Ross for GHOP.
........
r59358 | raymond.hettinger | 2007-12-05 19:11:08 +0100 (Wed, 05 Dec 2007) | 1 line
Error checking was too aggressive (reported by Chris Tismer)
........
r59359 | georg.brandl | 2007-12-05 19:30:48 +0100 (Wed, 05 Dec 2007) | 2 lines
Add examples to re docs. Written for GHOP by Dan Finnie.
........
r59366 | georg.brandl | 2007-12-05 20:49:21 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix markup.
........
r59367 | christian.heimes | 2007-12-05 20:57:54 +0100 (Wed, 05 Dec 2007) | 1 line
Updated documentation and build_tkinter.py script
........
r59368 | georg.brandl | 2007-12-05 21:03:57 +0100 (Wed, 05 Dec 2007) | 2 lines
Another markup fix.
........
r59369 | ronald.oussoren | 2007-12-05 21:07:36 +0100 (Wed, 05 Dec 2007) | 7 lines
This "fixes" compilation issues for the Carbon._OSA module on OSX Leopard
by purging bindings to OSA's debug API's. Those APIs we're completely
unsupported on OSX 10.4 and are no longer available on OSX 10.5.
Note that this patches a generated file. This is somewhat acceptable because
regenerating the file is non-trivial and wouldn't use system headers anyway.
........
r59370 | christian.heimes | 2007-12-05 21:10:38 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed bug #1557 by using popen.communicate() before popen.wait()
........
2007-12-05 16:18:38 -04:00
|
|
|
[' File "spam.py", line 3, in <module>\n spam.eggs()\n',
|
|
|
|
' File "eggs.py", line 42, in eggs\n return "bacon"\n']
|
2009-04-27 13:22:44 -03:00
|
|
|
>>> an_error = IndexError('tuple index out of range')
|
|
|
|
>>> traceback.format_exception_only(type(an_error), an_error)
|
Merged revisions 59333-59370 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59343 | georg.brandl | 2007-12-05 08:02:47 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix typo.
........
r59347 | christian.heimes | 2007-12-05 13:31:44 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed quoting and paths in the sqlite project file
........
r59348 | christian.heimes | 2007-12-05 13:45:11 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed error in regrtest. I must have missed the spot.
........
r59350 | christian.heimes | 2007-12-05 13:49:14 +0100 (Wed, 05 Dec 2007) | 1 line
merge -r59315:59316 from py3k: Fix issue #1553: An errornous __length_hint__ can make list() raise a SystemError
........
r59352 | christian.heimes | 2007-12-05 13:52:34 +0100 (Wed, 05 Dec 2007) | 1 line
Added msg to Misc/NEWS
........
r59354 | andrew.kuchling | 2007-12-05 14:27:20 +0100 (Wed, 05 Dec 2007) | 1 line
Spelling fix
........
r59356 | georg.brandl | 2007-12-05 18:56:50 +0100 (Wed, 05 Dec 2007) | 3 lines
Add examples to csv, pprint and traceback docs.
Written by Ross for GHOP.
........
r59358 | raymond.hettinger | 2007-12-05 19:11:08 +0100 (Wed, 05 Dec 2007) | 1 line
Error checking was too aggressive (reported by Chris Tismer)
........
r59359 | georg.brandl | 2007-12-05 19:30:48 +0100 (Wed, 05 Dec 2007) | 2 lines
Add examples to re docs. Written for GHOP by Dan Finnie.
........
r59366 | georg.brandl | 2007-12-05 20:49:21 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix markup.
........
r59367 | christian.heimes | 2007-12-05 20:57:54 +0100 (Wed, 05 Dec 2007) | 1 line
Updated documentation and build_tkinter.py script
........
r59368 | georg.brandl | 2007-12-05 21:03:57 +0100 (Wed, 05 Dec 2007) | 2 lines
Another markup fix.
........
r59369 | ronald.oussoren | 2007-12-05 21:07:36 +0100 (Wed, 05 Dec 2007) | 7 lines
This "fixes" compilation issues for the Carbon._OSA module on OSX Leopard
by purging bindings to OSA's debug API's. Those APIs we're completely
unsupported on OSX 10.4 and are no longer available on OSX 10.5.
Note that this patches a generated file. This is somewhat acceptable because
regenerating the file is non-trivial and wouldn't use system headers anyway.
........
r59370 | christian.heimes | 2007-12-05 21:10:38 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed bug #1557 by using popen.communicate() before popen.wait()
........
2007-12-05 16:18:38 -04:00
|
|
|
['IndexError: tuple index out of range\n']
|