summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomas R. <tomas.roun8@gmail.com>2024-12-03 16:08:39 (GMT)
committerGitHub <noreply@github.com>2024-12-03 16:08:39 (GMT)
commit8ba9f5bca9c0ce6130e1f4ba761a68f74f8457d0 (patch)
tree16e7ab36bd779602983dc8564ee490182988acb4
parent412e11fe6e37f15971ef855f88b8b01bb3297679 (diff)
downloadcpython-8ba9f5bca9c0ce6130e1f4ba761a68f74f8457d0.zip
cpython-8ba9f5bca9c0ce6130e1f4ba761a68f74f8457d0.tar.gz
cpython-8ba9f5bca9c0ce6130e1f4ba761a68f74f8457d0.tar.bz2
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__`.
-rw-r--r--Doc/library/traceback.rst7
-rw-r--r--Lib/test/test_traceback.py3
-rw-r--r--Lib/traceback.py2
-rw-r--r--Misc/NEWS.d/next/Documentation/2024-11-27-22-56-48.gh-issue-127347.xyddWS.rst1
4 files changed, 10 insertions, 3 deletions
diff --git a/Doc/library/traceback.rst b/Doc/library/traceback.rst
index 100a92b..8f94fc4 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 ec69412..ea8d9f2 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 f731492..6367c00 100644
--- a/Lib/traceback.py
+++ b/Lib/traceback.py
@@ -15,7 +15,7 @@ __all__ = ['extract_stack', 'extract_tb', 'format_exception',
'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 0000000..79b3faa
--- /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__`.