#8011: use exc.tb_lineno instead of traceback.tb_lineno() and pep8ify variable names.

This commit is contained in:
Ezio Melotti 2010-03-13 01:21:34 +00:00
parent c4785a7547
commit 93dd9b808e
1 changed files with 9 additions and 9 deletions

View File

@ -175,12 +175,12 @@ exception and traceback::
try: try:
lumberjack() lumberjack()
except: except IndexError:
exceptionType, exceptionValue, exceptionTraceback = sys.exc_info() exc_type, exc_value, exc_traceback = sys.exc_info()
print "*** print_tb:" print "*** print_tb:"
traceback.print_tb(exceptionTraceback, limit=1, file=sys.stdout) traceback.print_tb(exc_traceback, limit=1, file=sys.stdout)
print "*** print_exception:" print "*** print_exception:"
traceback.print_exception(exceptionType, exceptionValue, exceptionTraceback, traceback.print_exception(exc_type, exc_value, exc_traceback,
limit=2, file=sys.stdout) limit=2, file=sys.stdout)
print "*** print_exc:" print "*** print_exc:"
traceback.print_exc() traceback.print_exc()
@ -189,13 +189,13 @@ exception and traceback::
print formatted_lines[0] print formatted_lines[0]
print formatted_lines[-1] print formatted_lines[-1]
print "*** format_exception:" print "*** format_exception:"
print repr(traceback.format_exception(exceptionType, exceptionValue, print repr(traceback.format_exception(exc_type, exc_value,
exceptionTraceback)) exc_traceback))
print "*** extract_tb:" print "*** extract_tb:"
print repr(traceback.extract_tb(exceptionTraceback)) print repr(traceback.extract_tb(exc_traceback))
print "*** format_tb:" print "*** format_tb:"
print repr(traceback.format_tb(exceptionTraceback)) print repr(traceback.format_tb(exc_traceback))
print "*** tb_lineno:", traceback.tb_lineno(exceptionTraceback) print "*** tb_lineno:", exc_traceback.tb_lineno
The output for the example would look similar to this:: The output for the example would look similar to this::