@@ -135,15 +135,10 @@ def _fixed_getframes(etb, context=1, tb_offset=0):
135135    aux  =  traceback .extract_tb (etb )
136136    assert  len (records ) ==  len (aux )
137137    for  i , (file , lnum , _ , _ ) in  enumerate (aux ):
138-         maybeStart  =  lnum  -  1  -  context  //  2 
139-         start  =  max (maybeStart , 0 )
138+         maybe_start  =  lnum  -  1  -  context  //  2 
139+         start  =  max (maybe_start , 0 )
140140        end  =  start  +  context 
141141        lines  =  linecache .getlines (file )[start :end ]
142-         # pad with empty lines if necessary 
143-         if  maybeStart  <  0 :
144-             lines  =  (['\n ' ] *  - maybeStart ) +  lines 
145-         if  len (lines ) <  context :
146-             lines  +=  ['\n ' ] *  (context  -  len (lines ))
147142        buf  =  list (records [i ])
148143        buf [LNUM_POS ] =  lnum 
149144        buf [INDEX_POS ] =  lnum  -  1  -  start 
@@ -355,13 +350,7 @@ def format_exc(etype, evalue, etb, context=5, tb_offset=0):
355350        pyver )
356351
357352    # Drop topmost frames if requested 
358-     try :
359-         records  =  _fixed_getframes (etb , context , tb_offset )
360-     except :
361-         raise 
362-         print ('\n Unfortunately, your original traceback can not be ' 
363-               'constructed.\n ' )
364-         return  '' 
353+     records  =  _fixed_getframes (etb , context , tb_offset )
365354
366355    # Get (safely) a string form of the exception info 
367356    try :
@@ -397,18 +386,13 @@ def format_outer_frames(context=5, stack_start=None, stack_end=None,
397386                filename  =  filename [:- 4 ] +  '.py' 
398387        if  ignore_ipython :
399388            # Hack to avoid printing the internals of IPython 
400-             if  (os .path .basename (filename ) ==   'iplib.py' 
401-                         and  func_name  in  ('safe_execfile' , 'runcode' )):
389+             if  (os .path .basename (filename ) in  ( 'iplib.py' ,  'py3compat.py' ) 
390+                         and  func_name  in  ('execfile'  ,  ' safe_execfile''runcode' )):
402391                break 
403-         maybeStart  =  line_no  -  1  -  context  //  2 
404-         start  =  max (maybeStart , 0 )
392+         maybe_start  =  line_no  -  1  -  context  //  2 
393+         start  =  max (maybe_start , 0 )
405394        end  =  start  +  context 
406395        lines  =  linecache .getlines (filename )[start :end ]
407-         # pad with empty lines if necessary 
408-         if  maybeStart  <  0 :
409-             lines  =  (['\n ' ] *  - maybeStart ) +  lines 
410-         if  len (lines ) <  context :
411-             lines  +=  ['\n ' ] *  (context  -  len (lines ))
412396        buf  =  list (records [i ])
413397        buf [LNUM_POS ] =  line_no 
414398        buf [INDEX_POS ] =  line_no  -  1  -  start 
0 commit comments