]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-127347: Document `traceback.print_list` (#127348)
authorTomas R. <tomas.roun8@gmail.com>
Tue, 3 Dec 2024 16:08:39 +0000 (17:08 +0100)
committerGitHub <noreply@github.com>
Tue, 3 Dec 2024 16:08:39 +0000 (18:08 +0200)
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__`.

Doc/library/traceback.rst
Lib/test/test_traceback.py
Lib/traceback.py
Misc/NEWS.d/next/Documentation/2024-11-27-22-56-48.gh-issue-127347.xyddWS.rst [new file with mode: 0644]

index 100a92b73d5497a0c23fa5445b16aace030d5adc..8f94fc448f2482aea92fc1b11ed09f3f44351bfd 100644 (file)
@@ -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
index ec69412f5511ebfd3d66f380c2c4ecd7957c9376..ea8d9f2137aca58afb1a8ffcbe74fc4bb32e9417 100644 (file)
@@ -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':
index f73149271b9bc9f9fc86bc44f96c5143cf771be0..6367c00e4d4b86916c5a451f8f3dd2d092c159bf 100644 (file)
@@ -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 (file)
index 0000000..79b3faa
--- /dev/null
@@ -0,0 +1 @@
+Publicly expose :func:`traceback.print_list` in :attr:`!traceback.__all__`.