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