Ignore:
Timestamp:
Mar 19, 2014, 11:11:30 AM (11 years ago)
Author:
dmik
Message:

python: Update vendor to 2.7.6.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/vendor/current/Lib/traceback.py

    r2 r388  
    6565        name = co.co_name
    6666        _print(file,
    67                '  File "%s", line %d, in %s' % (filename,lineno,name))
     67               '  File "%s", line %d, in %s' % (filename, lineno, name))
    6868        linecache.checkcache(filename)
    6969        line = linecache.getline(filename, lineno, f.f_globals)
     
    7373
    7474def format_tb(tb, limit = None):
    75     """A shorthand for 'format_list(extract_stack(f, limit))."""
     75    """A shorthand for 'format_list(extract_tb(tb, limit))'."""
    7676    return format_list(extract_tb(tb, limit))
    7777
     
    125125        print_tb(tb, limit, file)
    126126    lines = format_exception_only(etype, value)
    127     for line in lines[:-1]:
    128         _print(file, line, ' ')
    129     _print(file, lines[-1], '')
     127    for line in lines:
     128        _print(file, line, '')
    130129
    131130def format_exception(etype, value, tb, limit = None):
     
    168167    #
    169168    # Clear these out first because issubtype(string1, SyntaxError)
    170     # would throw another exception and mask the original problem.
     169    # would raise another exception and mask the original problem.
    171170    if (isinstance(etype, BaseException) or
    172171        isinstance(etype, types.InstanceType) or
     
    196195                # only three spaces to account for offset1 == pos 0
    197196                lines.append('   %s^\n' % ''.join(caretspace))
    198             value = msg
     197        value = msg
    199198
    200199    lines.append(_format_final_exc_line(stype, value))
     
    213212    try:
    214213        return str(value)
    215     except:
    216         return '<unprintable %s object>' % type(value).__name__
     214    except Exception:
     215        pass
     216    try:
     217        value = unicode(value)
     218        return value.encode("ascii", "backslashreplace")
     219    except Exception:
     220        pass
     221    return '<unprintable %s object>' % type(value).__name__
    217222
    218223
     
    242247    """This is a shorthand for 'print_exception(sys.last_type,
    243248    sys.last_value, sys.last_traceback, limit, file)'."""
     249    if not hasattr(sys, "last_type"):
     250        raise ValueError("no last exception")
    244251    if file is None:
    245252        file = sys.stderr
Note: See TracChangeset for help on using the changeset viewer.