]> granicus.if.org Git - python/commitdiff
merge with 3.3
authorGeorg Brandl <georg@python.org>
Sun, 13 Oct 2013 21:34:06 +0000 (23:34 +0200)
committerGeorg Brandl <georg@python.org>
Sun, 13 Oct 2013 21:34:06 +0000 (23:34 +0200)
1  2 
Lib/traceback.py

index d5b37528babd8a5579db8def4df997d9a45ea4f2,b13bfe2497cd653511119df3ba410529aabb0233..3b2cae748e97d24242e46a1cdbdbe2008b596a8b
@@@ -86,11 -50,29 +86,11 @@@ def print_tb(tb, limit=None, file=None)
      'file' should be an open file or file-like object with a write()
      method.
      """
 -    if file is None:
 -        file = sys.stderr
 -    if limit is None:
 -        if hasattr(sys, 'tracebacklimit'):
 -            limit = sys.tracebacklimit
 -    n = 0
 -    while tb is not None and (limit is None or n < limit):
 -        f = tb.tb_frame
 -        lineno = tb.tb_lineno
 -        co = f.f_code
 -        filename = co.co_filename
 -        name = co.co_name
 -        _print(file,
 -               '  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())
 -        tb = tb.tb_next
 -        n = n+1
 +    print_list(extract_tb(tb, limit=limit), file=file)
  
  def format_tb(tb, limit=None):
-     """A shorthand for 'format_list(extract_tb(tb, limit))."""
+     """A shorthand for 'format_list(extract_tb(tb, limit))'."""
 -    return format_list(extract_tb(tb, limit))
 +    return format_list(extract_tb(tb, limit=limit))
  
  def extract_tb(tb, limit=None):
      """Return list of up to limit pre-processed entries from traceback.