@@ -401,9 +401,9 @@ exception and traceback:
401
401
import sys, traceback
402
402
403
403
def lumberjack():
404
- bright_side_of_death ()
404
+ bright_side_of_life ()
405
405
406
- def bright_side_of_death ():
406
+ def bright_side_of_life ():
407
407
return tuple()[0]
408
408
409
409
try:
@@ -413,19 +413,15 @@ exception and traceback:
413
413
print("*** print_tb:")
414
414
traceback.print_tb(exc_traceback, limit=1, file=sys.stdout)
415
415
print("* ** print_exception:")
416
- # exc_type below is ignored on 3.5 and later
417
- traceback.print_exception(exc_type, exc_value, exc_traceback,
418
- limit=2, file=sys.stdout)
416
+ traceback.print_exception(exc_value, limit=2, file=sys.stdout)
419
417
print("*** print_exc:")
420
418
traceback.print_exc(limit=2, file=sys.stdout)
421
419
print("* ** format_exc, first and last line:")
422
420
formatted_lines = traceback.format_exc().splitlines()
423
421
print(formatted_lines[0])
424
422
print(formatted_lines[-1])
425
423
print("*** format_exception:")
426
- # exc_type below is ignored on 3.5 and later
427
- print(repr(traceback.format_exception(exc_type, exc_value,
428
- exc_traceback)))
424
+ print(repr(traceback.format_exception(exc_value)))
429
425
print("* ** extract_tb:")
430
426
print(repr(traceback.extract_tb(exc_traceback)))
431
427
print("*** format_tb:")
@@ -445,32 +441,32 @@ The
8000
output for the example would look similar to this:
445
441
File "<doctest...>", line 10, in <module>
446
442
lumberjack()
447
443
File "<doctest...>", line 4, in lumberjack
448
- bright_side_of_death ()
444
+ bright_side_of_life ()
449
445
IndexError: tuple index out of range
450
446
*** print_exc:
451
447
Traceback (most recent call last):
452
448
File "<doctest...>", line 10, in <module>
453
449
lumberjack()
454
450
File "<doctest...>", line 4, in lumberjack
455
- bright_side_of_death ()
451
+ bright_side_of_life ()
456
452
IndexError: tuple index out of range
457
453
* ** format_exc, first and last line:
458
454
Traceback (most recent call last):
459
455
IndexError: tuple index out of range
460
456
*** format_exception:
461
457
['Traceback (most recent call last):\n ',
462
458
' File "<doctest...>", line 10, in <module>\n lumberjack()\n ',
463
- ' File "<doctest...>", line 4, in lumberjack\n bright_side_of_death ()\n ',
464
- ' File "<doctest...>", line 7, in bright_side_of_death \n return tuple()[0]\n ',
459
+ ' File "<doctest...>", line 4, in lumberjack\n bright_side_of_life ()\n ',
460
+ ' File "<doctest...>", line 7, in bright_side_of_life \n return tuple()[0]\n ',
465
461
'IndexError: tuple index out of range\n ']
466
462
* ** extract_tb:
467
463
[<FrameSummary file <doctest...>, line 10 in <module>>,
468
464
<FrameSummary file <doctest...>, line 4 in lumberjack>,
469
- <FrameSummary file <doctest...>, line 7 in bright_side_of_death >]
465
+ <FrameSummary file <doctest...>, line 7 in bright_side_of_life >]
470
466
*** format_tb:
471
467
[' File "<doctest...>", line 10, in <module>\n lumberjack()\n ',
472
- ' File "<doctest...>", line 4, in lumberjack\n bright_side_of_death ()\n ',
473
- ' File "<doctest...>", line 7, in bright_side_of_death \n return tuple()[0]\n ']
468
+ ' File "<doctest...>", line 4, in lumberjack\n bright_side_of_life ()\n ',
469
+ ' File "<doctest...>", line 7, in bright_side_of_life \n return tuple()[0]\n ']
474
470
* ** tb_lineno: 10
475
471
476
472
0 commit comments