Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7b7320e

Browse files
committed
Merged revisions 78896 via svnmerge from
svn+ssh://[email protected]/python/branches/py3k ................ r78896 | ezio.melotti | 2010-03-13 03:28:34 +0200 (Sat, 13 Mar 2010) | 9 lines Merged revisions 78895 via svnmerge from svn+ssh://[email protected]/python/trunk ........ r78895 | ezio.melotti | 2010-03-13 03:21:34 +0200 (Sat, 13 Mar 2010) | 1 line #8011: use exc.tb_lineno instead of traceback.tb_lineno() and pep8ify variable names. ........ ................
1 parent 9ebc187 commit 7b7320e

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

Doc/library/traceback.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -172,12 +172,12 @@ exception and traceback:
172172

173173
try:
174174
lumberjack()
175-
except:
176-
exceptionType, exceptionValue, exceptionTraceback = sys.exc_info()
175+
except IndexError:
176+
exc_type, exc_value, exc_traceback = sys.exc_info()
177177
print("*** print_tb:")
178-
traceback.print_tb(exceptionTraceback, limit=1, file=sys.stdout)
178+
traceback.print_tb(exc_traceback, limit=1, file=sys.stdout)
179179
print("*** print_exception:")
180-
traceback.print_exception(exceptionType, exceptionValue, exceptionTraceback,
180+
traceback.print_exception(exc_type, exc_value, exc_traceback,
181181
limit=2, file=sys.stdout)
182182
print("*** print_exc:")
183183
traceback.print_exc()
@@ -186,13 +186,13 @@ exception and traceback:
186186
print(formatted_lines[0])
187187
print(formatted_lines[-1])
188188
print("*** format_exception:")
189-
print(repr(traceback.format_exception(exceptionType, exceptionValue,
190-
exceptionTraceback)))
189+
print(repr(traceback.format_exception(exc_type, exc_value,
190+
exc_traceback)))
191191
print("*** extract_tb:")
192-
print(repr(traceback.extract_tb(exceptionTraceback)))
192+
print(repr(traceback.extract_tb(exc_traceback)))
193193
print("*** format_tb:")
194-
print(repr(traceback.format_tb(exceptionTraceback)))
195-
print("*** tb_lineno:", traceback.tb_lineno(exceptionTraceback))
194+
print(repr(traceback.format_tb(exc_traceback)))
195+
print("*** tb_lineno:", exc_traceback.tb_lineno)
196196

197197
The output for the example would look similar to this:
198198

0 commit comments

Comments
 (0)