Skip to content

Commit 8ba9f5b

Browse files
authored
gh-127347: Document traceback.print_list (#127348)
Previously, `traceback.print_list` didn't have a documentation entry and was not exposed in `traceback.__all__`. Now it has a documentation entry and is exposed in `__all__`.
1 parent 412e11f commit 8ba9f5b

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

Doc/library/traceback.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,13 @@ Module-Level Functions
157157
arguments have the same meaning as for :func:`print_stack`.
158158

159159

160+
.. function:: print_list(extracted_list, file=None)
161+
162+
Print the list of tuples as returned by :func:`extract_tb` or
163+
:func:`extract_stack` as a formatted stack trace to the given file.
164+
If *file* is ``None``, the output is written to :data:`sys.stderr`.
165+
166+
160167
.. function:: format_list(extracted_list)
161168

162169
Given a list of tuples or :class:`FrameSummary` objects as returned by

Lib/test/test_traceback.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4488,9 +4488,8 @@ class MiscTest(unittest.TestCase):
44884488

44894489
def test_all(self):
44904490
expected = set()
4491-
denylist = {'print_list'}
44924491
for name in dir(traceback):
4493-
if name.startswith('_') or name in denylist:
4492+
if name.startswith('_'):
44944493
continue
44954494
module_object = getattr(traceback, name)
44964495
if getattr(module_object, '__module__', None) == 'traceback':

Lib/traceback.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
'format_tb', 'print_exc', 'format_exc', 'print_exception',
1616
'print_last', 'print_stack', 'print_tb', 'clear_frames',
1717
'FrameSummary', 'StackSummary', 'TracebackException',
18-
'walk_stack', 'walk_tb']
18+
'walk_stack', 'walk_tb', 'print_list']
1919

2020
#
2121
# Formatting and printing lists of traceback lines.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Publicly expose :func:`traceback.print_list` in :attr:`!traceback.__all__`.

0 commit comments

Comments
 (0)