summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorBerker Peksag <berker.peksag@gmail.com>2015-04-08 06:47:14 (GMT)
committerBerker Peksag <berker.peksag@gmail.com>2015-04-08 06:47:14 (GMT)
commit716b3d3e9137aeeed4ee3480a5302c54442405b6 (patch)
tree394ac837de2e3af43b835877a2a05081e215471c /Lib
parentcb6fdf2c63961e8b9111357ca57c3de27d029820 (diff)
downloadcpython-716b3d3e9137aeeed4ee3480a5302c54442405b6.zip
cpython-716b3d3e9137aeeed4ee3480a5302c54442405b6.tar.gz
cpython-716b3d3e9137aeeed4ee3480a5302c54442405b6.tar.bz2
Issue #23883: Add missing entries to traceback.__all__.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_traceback.py23
-rw-r--r--Lib/traceback.py5
2 files changed, 19 insertions, 9 deletions
diff --git a/Lib/test/test_traceback.py b/Lib/test/test_traceback.py
index 9c8929f..2fa85f5 100644
--- a/Lib/test/test_traceback.py
+++ b/Lib/test/test_traceback.py
@@ -6,8 +6,7 @@ import linecache
import sys
import unittest
import re
-from test.support import run_unittest, Error, captured_output
-from test.support import TESTFN, unlink, cpython_only
+from test.support import TESTFN, Error, captured_output, unlink, cpython_only
from test.script_helper import assert_python_ok
import textwrap
@@ -593,7 +592,7 @@ class TestStack(unittest.TestCase):
traceback.walk_stack(None), capture_locals=True, limit=1)
s = some_inner(3, 4)
self.assertEqual(
- [' File "' + __file__ + '", line 593, '
+ [' File "' + __file__ + '", line 592, '
'in some_inner\n'
' traceback.walk_stack(None), capture_locals=True, limit=1)\n'
' a = 1\n'
@@ -603,7 +602,6 @@ class TestStack(unittest.TestCase):
], s.format())
-
class TestTracebackException(unittest.TestCase):
def test_smoke(self):
@@ -732,8 +730,19 @@ class TestTracebackException(unittest.TestCase):
self.assertEqual(exc.stack[0].locals, None)
-def test_main():
- run_unittest(__name__)
+class MiscTest(unittest.TestCase):
+
+ def test_all(self):
+ expected = set()
+ blacklist = {'print_list'}
+ for name in dir(traceback):
+ if name.startswith('_') or name in blacklist:
+ continue
+ module_object = getattr(traceback, name)
+ if getattr(module_object, '__module__', None) == 'traceback':
+ expected.add(name)
+ self.assertCountEqual(traceback.__all__, expected)
+
if __name__ == "__main__":
- test_main()
+ unittest.main()
diff --git a/Lib/traceback.py b/Lib/traceback.py
index f7705cd..8a554cf 100644
--- a/Lib/traceback.py
+++ b/Lib/traceback.py
@@ -7,8 +7,9 @@ import operator
__all__ = ['extract_stack', 'extract_tb', 'format_exception',
'format_exception_only', 'format_list', 'format_stack',
'format_tb', 'print_exc', 'format_exc', 'print_exception',
- 'print_last', 'print_stack', 'print_tb',
- 'clear_frames']
+ 'print_last', 'print_stack', 'print_tb', 'clear_frames',
+ 'FrameSummary', 'StackSummary', 'TracebackException',
+ 'walk_stack', 'walk_tb']
#
# Formatting and printing lists of traceback lines.