https://github.com/python/cpython/commit/8ba9f5bca9c0ce6130e1f4ba761a68f74f8457d0
commit: 8ba9f5bca9c0ce6130e1f4ba761a68f74f8457d0
branch: main
author: Tomas R. <[email protected]>
committer: Eclips4 <[email protected]>
date: 2024-12-03T18:08:39+02:00
summary:
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__`.
files:
A Misc/NEWS.d/next/Documentation/2024-11-27-22-56-48.gh-issue-127347.xyddWS.rst
M Doc/library/traceback.rst
M Lib/test/test_traceback.py
M Lib/traceback.py
diff --git a/Doc/library/traceback.rst b/Doc/library/traceback.rst
index 100a92b73d5497..8f94fc448f2482 100644
--- a/Doc/library/traceback.rst
+++ b/Doc/library/traceback.rst
@@ -157,6 +157,13 @@ Module-Level Functions
arguments have the same meaning as for :func:`print_stack`.
+.. function:: print_list(extracted_list, file=None)
+
+ Print the list of tuples as returned by :func:`extract_tb` or
+ :func:`extract_stack` as a formatted stack trace to the given file.
+ If *file* is ``None``, the output is written to :data:`sys.stderr`.
+
+
.. function:: format_list(extracted_list)
Given a list of tuples or :class:`FrameSummary` objects as returned by
diff --git a/Lib/test/test_traceback.py b/Lib/test/test_traceback.py
index ec69412f5511eb..ea8d9f2137aca5 100644
--- a/Lib/test/test_traceback.py
+++ b/Lib/test/test_traceback.py
@@ -4488,9 +4488,8 @@ class MiscTest(unittest.TestCase):
def test_all(self):
expected = set()
- denylist = {'print_list'}
for name in dir(traceback):
- if name.startswith('_') or name in denylist:
+ if name.startswith('_'):
continue
module_object = getattr(traceback, name)
if getattr(module_object, '__module__', None) == 'traceback':
diff --git a/Lib/traceback.py b/Lib/traceback.py
index f73149271b9bc9..6367c00e4d4b86 100644
--- a/Lib/traceback.py
+++ b/Lib/traceback.py
@@ -15,7 +15,7 @@
'format_tb', 'print_exc', 'format_exc', 'print_exception',
'print_last', 'print_stack', 'print_tb', 'clear_frames',
'FrameSummary', 'StackSummary', 'TracebackException',
- 'walk_stack', 'walk_tb']
+ 'walk_stack', 'walk_tb', 'print_list']
#
# Formatting and printing lists of traceback lines.
diff --git
a/Misc/NEWS.d/next/Documentation/2024-11-27-22-56-48.gh-issue-127347.xyddWS.rst
b/Misc/NEWS.d/next/Documentation/2024-11-27-22-56-48.gh-issue-127347.xyddWS.rst
new file mode 100644
index 00000000000000..79b3faa3d0d385
--- /dev/null
+++
b/Misc/NEWS.d/next/Documentation/2024-11-27-22-56-48.gh-issue-127347.xyddWS.rst
@@ -0,0 +1 @@
+Publicly expose :func:`traceback.print_list` in :attr:`!traceback.__all__`.
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]