PEP 454: set_traceback_limit() requires nframe >= 1

This commit is contained in:
Victor Stinner 2013-11-10 23:54:37 +01:00
parent fdf301d0d0
commit 596ee26d32
1 changed files with 4 additions and 8 deletions

View File

@ -153,6 +153,7 @@ Functions
``set_traceback_limit(nframe: int)`` function: ``set_traceback_limit(nframe: int)`` function:
Set the maximum number of frames stored in the traceback of a trace. Set the maximum number of frames stored in the traceback of a trace.
*nframe* must be greater or equal to ``1``.
Storing more frames allocates more memory of the ``tracemalloc`` Storing more frames allocates more memory of the ``tracemalloc``
module and makes Python slower. Use the ``get_tracemalloc_memory()`` module and makes Python slower. Use the ``get_tracemalloc_memory()``
@ -163,9 +164,6 @@ Functions
grouped by ``'traceback'`` or to compute cumulative statistics: see grouped by ``'traceback'`` or to compute cumulative statistics: see
the ``Snapshot.statistics()`` method. the ``Snapshot.statistics()`` method.
If the limit is set to ``0`` frame, a traceback with a frame will be
used for all traces: filename ``'<unknown>'`` at line number ``0``.
Use the ``get_traceback_limit()`` function to get the current limit. Use the ``get_traceback_limit()`` function to get the current limit.
The ``PYTHONTRACEMALLOC`` environment variable The ``PYTHONTRACEMALLOC`` environment variable
@ -456,11 +454,9 @@ Traceback
Sequence of ``Frame`` instances sorted from the most recent frame to Sequence of ``Frame`` instances sorted from the most recent frame to
the oldest frame. the oldest frame.
A traceback contains at least ``1`` frame. If the ``tracemalloc`` A traceback contains at least ``1`` frame. If the ``tracemalloc`` module
module failed to get a frame, the filename ``"<unknown>"`` and the failed to get a frame, the filename ``"<unknown>"`` at line number ``0`` is
line number ``0`` are used. If it failed to get the traceback or if used.
the traceback limit is ``0``, the traceback only contains a frame:
filename ``'<unknown>'`` at line number ``0``.
When a snapshot is taken, tracebacks of traces are limited to When a snapshot is taken, tracebacks of traces are limited to
``get_traceback_limit()`` frames. See the ``take_snapshot()`` ``get_traceback_limit()`` frames. See the ``take_snapshot()``