diff options
author | Ezio Melotti <ezio.melotti@gmail.com> | 2010-03-13 01:21:34 (GMT) |
---|---|---|
committer | Ezio Melotti <ezio.melotti@gmail.com> | 2010-03-13 01:21:34 (GMT) |
commit | 93dd9b808ec306723878b94dd9b8ab0748e4f1ec (patch) | |
tree | 08014bb8264ff858b81f5e6b1762f24264e5ff9d /Doc | |
parent | c4785a75479d420d7cfa50445f34dabb1bf50d7d (diff) | |
download | cpython-93dd9b808ec306723878b94dd9b8ab0748e4f1ec.zip cpython-93dd9b808ec306723878b94dd9b8ab0748e4f1ec.tar.gz cpython-93dd9b808ec306723878b94dd9b8ab0748e4f1ec.tar.bz2 |
#8011: use exc.tb_lineno instead of traceback.tb_lineno() and pep8ify variable names.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/traceback.rst | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/Doc/library/traceback.rst b/Doc/library/traceback.rst index 9c8c93f..15eaa6e 100644 --- a/Doc/library/traceback.rst +++ b/Doc/library/traceback.rst @@ -175,12 +175,12 @@ exception and traceback:: try: lumberjack() - except: - exceptionType, exceptionValue, exceptionTraceback = sys.exc_info() + except IndexError: + exc_type, exc_value, exc_traceback = sys.exc_info() 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:" - traceback.print_exception(exceptionType, exceptionValue, exceptionTraceback, + traceback.print_exception(exc_type, exc_value, exc_traceback, limit=2, file=sys.stdout) print "*** print_exc:" traceback.print_exc() @@ -189,13 +189,13 @@ exception and traceback:: print formatted_lines[0] print formatted_lines[-1] print "*** format_exception:" - print repr(traceback.format_exception(exceptionType, exceptionValue, - exceptionTraceback)) + print repr(traceback.format_exception(exc_type, exc_value, + exc_traceback)) print "*** extract_tb:" - print repr(traceback.extract_tb(exceptionTraceback)) + print repr(traceback.extract_tb(exc_traceback)) print "*** format_tb:" - print repr(traceback.format_tb(exceptionTraceback)) - print "*** tb_lineno:", traceback.tb_lineno(exceptionTraceback) + print repr(traceback.format_tb(exc_traceback)) + print "*** tb_lineno:", exc_traceback.tb_lineno The output for the example would look similar to this:: |