diff options
author | Irit Katriel <1055913+iritkatriel@users.noreply.github.com> | 2022-09-05 21:30:51 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-05 21:30:51 (GMT) |
commit | c4999f261fb0cb28ef713b48ef2e81ca5a3eb1e1 (patch) | |
tree | d191876da69382ad82baad3f9483a2ee9cbc48da /Doc | |
parent | 52fe7e50c9945b7db60190b4b97e1213d05200b2 (diff) | |
download | cpython-c4999f261fb0cb28ef713b48ef2e81ca5a3eb1e1.zip cpython-c4999f261fb0cb28ef713b48ef2e81ca5a3eb1e1.tar.gz cpython-c4999f261fb0cb28ef713b48ef2e81ca5a3eb1e1.tar.bz2 |
[doc] Update example in traceback doc (GH-96600)
This Monty Python reference is of-its-time. It could seem inappropriate in the context of today's sensibilities around mental health.
Automerge-Triggered-By: GH:iritkatriel
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/traceback.rst | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/Doc/library/traceback.rst b/Doc/library/traceback.rst index 8cb6af9..f8c1eab 100644 --- a/Doc/library/traceback.rst +++ b/Doc/library/traceback.rst @@ -429,9 +429,9 @@ exception and traceback: import sys, traceback def lumberjack(): - bright_side_of_death() + bright_side_of_life() - def bright_side_of_death(): + def bright_side_of_life(): return tuple()[0] try: @@ -441,9 +441,7 @@ exception and traceback: print("*** print_tb:") traceback.print_tb(exc_traceback, limit=1, file=sys.stdout) print("*** print_exception:") - # exc_type below is ignored on 3.5 and later - traceback.print_exception(exc_type, exc_value, exc_traceback, - limit=2, file=sys.stdout) + traceback.print_exception(exc_value, limit=2, file=sys.stdout) print("*** print_exc:") traceback.print_exc(limit=2, file=sys.stdout) print("*** format_exc, first and last line:") @@ -451,9 +449,7 @@ exception and traceback: print(formatted_lines[0]) print(formatted_lines[-1]) print("*** format_exception:") - # exc_type below is ignored on 3.5 and later - print(repr(traceback.format_exception(exc_type, exc_value, - exc_traceback))) + print(repr(traceback.format_exception(exc_value))) print("*** extract_tb:") print(repr(traceback.extract_tb(exc_traceback))) print("*** format_tb:") @@ -473,14 +469,14 @@ The output for the example would look similar to this: File "<doctest...>", line 10, in <module> lumberjack() File "<doctest...>", line 4, in lumberjack - bright_side_of_death() + bright_side_of_life() IndexError: tuple index out of range *** print_exc: Traceback (most recent call last): File "<doctest...>", line 10, in <module> lumberjack() File "<doctest...>", line 4, in lumberjack - bright_side_of_death() + bright_side_of_life() IndexError: tuple index out of range *** format_exc, first and last line: Traceback (most recent call last): @@ -488,17 +484,17 @@ The output for the example would look similar to this: *** format_exception: ['Traceback (most recent call last):\n', ' File "<doctest default[0]>", line 10, in <module>\n lumberjack()\n', - ' File "<doctest default[0]>", line 4, in lumberjack\n bright_side_of_death()\n', - ' File "<doctest default[0]>", line 7, in bright_side_of_death\n return tuple()[0]\n ~~~~~~~^^^\n', + ' File "<doctest default[0]>", line 4, in lumberjack\n bright_side_of_life()\n', + ' File "<doctest default[0]>", line 7, in bright_side_of_life\n return tuple()[0]\n ~~~~~~~^^^\n', 'IndexError: tuple index out of range\n'] *** extract_tb: [<FrameSummary file <doctest...>, line 10 in <module>>, <FrameSummary file <doctest...>, line 4 in lumberjack>, - <FrameSummary file <doctest...>, line 7 in bright_side_of_death>] + <FrameSummary file <doctest...>, line 7 in bright_side_of_life>] *** format_tb: [' File "<doctest default[0]>", line 10, in <module>\n lumberjack()\n', - ' File "<doctest default[0]>", line 4, in lumberjack\n bright_side_of_death()\n', - ' File "<doctest default[0]>", line 7, in bright_side_of_death\n return tuple()[0]\n ~~~~~~~^^^\n'] + ' File "<doctest default[0]>", line 4, in lumberjack\n bright_side_of_life()\n', + ' File "<doctest default[0]>", line 7, in bright_side_of_life\n return tuple()[0]\n ~~~~~~~^^^\n'] *** tb_lineno: 10 |