| 839 | # --------------------------------------------------------------------------- |
| 840 | |
| 841 | def compact_traceback(): |
| 842 | t, v, tb = sys.exc_info() |
| 843 | tbinfo = [] |
| 844 | if not tb: # Must have a traceback |
| 845 | raise AssertionError("traceback does not exist") |
| 846 | while tb: |
| 847 | tbinfo.append(( |
| 848 | tb.tb_frame.f_code.co_filename, |
| 849 | tb.tb_frame.f_code.co_name, |
| 850 | str(tb.tb_lineno) |
| 851 | )) |
| 852 | tb = tb.tb_next |
| 853 | |
| 854 | # just to be safe |
| 855 | del tb |
| 856 | |
| 857 | file, function, line = tbinfo[-1] |
| 858 | info = ' '.join(['[%s|%s|%s]' % x for x in tbinfo]) |
| 859 | return (file, function, line), t, v, info |
| 860 | |
| 861 | def close_all(map=None, ignore_all=False): |
| 862 | if map is None: |