Skip to content

gh-135751: traceback: add recent_first and show_lines parameter #135752

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
fix doc
  • Loading branch information
methane committed Jun 21, 2025
commit 8d38237ef854d50bc7c4b1105e2bb3a638111efa
39 changes: 18 additions & 21 deletions Doc/library/traceback.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,11 @@ Module-Level Functions

If *recent_first* is true, the most recent stack trace entries are printed
first, otherwise the oldest entries are printed first. The default is false.

.. note::
``recent_first=True`` is useful for showing stack traces in places where
people see the top of the stack trace first, such as in a web browser.

``recent_first=False`` is useful for showing stack traces in places where
people see the bottom of the stack trace first, such as a console or log
files watched with :command:`tail -f`.
``recent_first=True`` is useful for showing stack traces in places where
people see the top of the stack trace first, such as in a web browser.
``recent_first=False`` is useful for showing stack traces in places where
people see the bottom of the stack trace first, such as a console or log
files watched with :command:`tail -f`.

.. note::

Expand All @@ -88,7 +85,7 @@ Module-Level Functions
Added negative *limit* support.

.. versionchanged:: next
Added *show_lines* and *recent_first* parameters.
Added the *show_lines* and *recent_first* parameters.


.. function:: print_exception(exc, /[, value, tb], limit=None, \
Expand Down Expand Up @@ -134,7 +131,7 @@ Module-Level Functions
positional-only.

.. versionchanged:: next
Added *show_lines* and *recent_first* parameters.
Added the *show_lines* and *recent_first* parameters.


.. function:: print_exc(limit=None, file=None, chain=True, *, show_lines=True, recent_first=False)
Expand All @@ -143,7 +140,7 @@ Module-Level Functions
chain=chain, show_lines=show_lines, recent_first=recent_first)``.

.. versionchanged:: next
Added *show_lines* and *recent_first* parameters.
Added the *show_lines* and *recent_first* parameters.


.. function:: print_last(limit=None, file=None, chain=True, *, show_lines=True, recent_first=False)
Expand All @@ -154,7 +151,7 @@ Module-Level Functions
prompt (see :data:`sys.last_exc`).

.. versionchanged:: next
Added *show_lines* and *recent_first* parameters.
Added the *show_lines* and *recent_first* parameters.


.. function:: print_stack(f=None, limit=None, file=None, *, show_lines=True, recent_first=False)
Expand All @@ -172,7 +169,7 @@ Module-Level Functions
Added negative *limit* support.

.. versionchanged:: next
Added *show_lines* and *recent_first* parameters.
Added the *show_lines* and *recent_first* parameters.


.. function:: extract_tb(tb, limit=None)
Expand Down Expand Up @@ -204,7 +201,7 @@ Module-Level Functions
If *show_lines* is true, source code lines are included in the output.

.. versionchanged:: next
Added *show_lines* parameter.
Added the *show_lines* parameter.


.. function:: format_list(extracted_list, *, show_lines=True)
Expand All @@ -218,7 +215,7 @@ Module-Level Functions
are included in the output.

.. versionchanged:: next
Added *show_lines* parameter.
Added the *show_lines* parameter.


.. function:: format_exception_only(exc, /[, value], *, show_group=False)
Expand Down Expand Up @@ -271,7 +268,7 @@ Module-Level Functions
:func:`print_exception`.

.. versionchanged:: next
Added *show_lines* and *recent_first* parameters.
Added the *show_lines* and *recent_first* parameters.


.. function:: format_exc(limit=None, chain=True, *, show_lines=True, recent_first=False)
Expand All @@ -284,7 +281,7 @@ Module-Level Functions
first, otherwise the oldest entries are printed first. The default is false.

.. versionchanged:: next
Added *show_lines* and *recent_first* parameters.
Added the *show_lines* and *recent_first* parameters.


.. function:: format_tb(tb, limit=None, *, show_lines=True, recent_first=False)
Expand All @@ -294,7 +291,7 @@ Module-Level Functions
If *recent_first* is true, ``reversed(extract_tb(tb, limit))`` is used.

.. versionchanged:: next
Added *show_lines* and *recent_first* parameters.
Added the *show_lines* and *recent_first* parameters.


.. function:: format_stack(f=None, limit=None, *, show_lines=True, recent_first=False)
Expand All @@ -304,7 +301,7 @@ Module-Level Functions
If *recent_first* is true, ``reversed(extract_stack(f, limit))`` is used.

.. versionchanged:: next
Added *show_lines* and *recent_first* parameters.
Added the *show_lines* and *recent_first* parameters.

.. function:: clear_frames(tb)

Expand Down Expand Up @@ -488,7 +485,7 @@ the module-level functions described above.
.. versionadded:: 3.11

.. versionchanged:: next
Added *show_lines* and *recent_first* parameters.
Added the *show_lines* and *recent_first* parameters.

.. method:: format(*, chain=True, show_lines=True, recent_first=False)

Expand All @@ -509,7 +506,7 @@ the module-level functions described above.
followed by the exception.

.. versionchanged:: next
Added *show_lines* and *recent_first* parameters.
Added the *show_lines* and *recent_first* parameters.

.. method:: format_exception_only(*, show_group=False)

Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy