Skip to content

Commit 71eef3e

Browse files
tomasr8srinivasreddy
authored andcommitted
pythongh-127347: Document traceback.print_list (python#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 0a68a73 commit 71eef3e

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

Doc/library/traceback.rst

+7
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

+1-2
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

+1-1
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.
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)