mirror of
https://github.com/python/cpython.git
synced 2025-08-30 13:38:43 +00:00
Merged revisions 71237-71238 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r71237 | georg.brandl | 2009-04-05 16:24:52 +0200 (So, 05 Apr 2009) | 1 line #1326077: fix traceback formatting of SyntaxErrors. This fixes two differences with formatting coming from Python: a) the reproduction of location details in the error message if no line text is given, b) the prefixing of the last line by one space. ........ r71238 | georg.brandl | 2009-04-05 16:25:41 +0200 (So, 05 Apr 2009) | 1 line Add NEWS entry for r71237. ........
This commit is contained in:
parent
dfd734429e
commit
236f7979ba
3 changed files with 22 additions and 16 deletions
|
@ -63,7 +63,7 @@ def print_tb(tb, limit=None, file=None):
|
|||
filename = co.co_filename
|
||||
name = co.co_name
|
||||
_print(file,
|
||||
' File "%s", line %d, in %s' % (filename,lineno,name))
|
||||
' File "%s", line %d, in %s' % (filename, lineno, name))
|
||||
linecache.checkcache(filename)
|
||||
line = linecache.getline(filename, lineno, f.f_globals)
|
||||
if line: _print(file, ' ' + line.strip())
|
||||
|
@ -159,9 +159,8 @@ def print_exception(etype, value, tb, limit=None, file=None, chain=True):
|
|||
_print(file, 'Traceback (most recent call last):')
|
||||
print_tb(tb, limit, file)
|
||||
lines = format_exception_only(type(value), value)
|
||||
for line in lines[:-1]:
|
||||
_print(file, line, ' ')
|
||||
_print(file, lines[-1], '')
|
||||
for line in lines:
|
||||
_print(file, line, '')
|
||||
|
||||
def format_exception(etype, value, tb, limit=None, chain=True):
|
||||
"""Format a stack trace and the exception information.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue