@@ -429,9 +429,9 @@ exception and traceback:
429
429
import sys, traceback
430
430
431
431
def lumberjack():
432
- bright_side_of_death ()
432
+ bright_side_of_life ()
433
433
434
- def bright_side_of_death ():
434
+ def bright_side_of_life ():
435
435
return tuple()[0]
436
436
437
437
try:
@@ -441,19 +441,15 @@ exception and traceback:
441
441
print("*** print_tb:")
442
442
traceback.print_tb(exc_traceback, limit=1, file=sys.stdout)
443
443
print("* ** print_exception:")
444
- # exc_type below is ignored on 3.5 and later
445
- traceback.print_exception(exc_type, exc_value, exc_traceback,
446
- limit=2, file=sys.stdout)
444
+ traceback.print_exception(exc_value, limit=2, file=sys.stdout)
447
445
print("*** print_exc:")
448
446
traceback.print_exc(limit=2, file=sys.stdout)
449
447
print("* ** format_exc, first and last line:")
450
448
formatted_lines = traceback.format_exc().splitlines()
451
449
print(formatted_lines[0])
452
450
print(formatted_lines[-1])
453
451
print("*** format_exception:")
454
- # exc_type below is ignored on 3.5 and later
455
- print(repr(traceback.format_exception(exc_type, exc_value,
456
- exc_traceback)))
452
+ print(repr(traceback.format_exception(exc_value)))
457
453
print("* ** extract_tb:")
458
454
print(repr(traceback.extract_tb(exc_traceback)))
459
455
print("*** format_tb:")
@@ -473,32 +469,32 @@ The output for the example would look similar to this:
473
469
File "<doctest...>", line 10, in <module>
474
470
lumberjack()
475
471
File "<doctest...>", line 4, in lumberjack
476
- bright_side_of_death ()
472
+ bright_side_of_life ()
477
473
IndexError: tuple index out of range
478
474
*** print_exc:
479
475
Traceback (most recent call last):
480
476
File "<doctest...>", line 10, in <module>
481
477
lumberjack()
482
478
File "<doctest...>", line 4, in lumberjack
483
- bright_side_of_death ()
479
+ bright_side_of_life ()
484
480
IndexError: tuple index out of range
485
481
* ** format_exc, first and last line:
486
482
Traceback (most recent call last):
487
483
IndexError: tuple index out of range
488
484
*** format_exception:
489
485
['Traceback (most recent call last):\n ',
490
486
' File "<doctest default[0]>", line 10, in <module>\n lumberjack()\n ',
491
- ' File "<doctest default[0]>", line 4, in lumberjack\n bright_side_of_death ()\n ',
492
- ' File "<doctest default[0]>", line 7, in bright_side_of_death \n return tuple()[0]\n ~~~~~~~^^^\n ',
487
+ ' File "<doctest default[0]>", line 4, in lumberjack\n bright_side_of_life ()\n ',
488
+ ' File "<doctest default[0]>", line 7, in bright_side_of_life \n return tuple()[0]\n ~~~~~~~^^^\n ',
493
489
'IndexError: tuple index out of range\n ']
494
490
* ** extract_tb:
495
491
[<FrameSummary file <doctest...>, line 10 in <module>>,
496
492
<FrameSummary file <doctest...>, line 4 in lumberjack>,
497
- <FrameSummary file <doctest...>, line 7 in bright_side_of_death >]
493
+ <FrameSummary file <doctest...>, line 7 in bright_side_of_life >]
498
494
*** format_tb:
499
495
[' File "<doctest default[0]>", line 10, in <module>\n lumberjack()\n ',
500
- ' File "<doctest default[0]>", line 4, in lumberjack\n bright_side_of_death ()\n ',
501
- ' File "<doctest default[0]>", line 7, in bright_side_of_death \n return tuple()[0]\n ~~~~~~~^^^\n ']
496
+ ' File "<doctest default[0]>", line 4, in lumberjack\n bright_side_of_life ()\n ',
497
+ ' File "<doctest default[0]>", line 7, in bright_side_of_life \n return tuple()[0]\n ~~~~~~~^^^\n ']
502
498
* ** tb_lineno: 10
503
499
504
500
0 commit comments