#NEWLINE# def fix_frame_records_filenames( records ) : #NEWLINE# #INDENT# 'Try to fix the filenames in each record from inspect.getinnerframes().\n\n    Particularly, modules loaded from within zip files have useless filenames\n    attached to their code object, and inspect.getinnerframes() just uses it.\n    ' #NEWLINE# fixed_records = [ ] #NEWLINE# for ( frame , filename , line_no , func_name , lines , index ) in records : #NEWLINE# #INDENT# better_fn = frame . f_globals . get ( '__file__' , None ) #NEWLINE# if isinstance ( better_fn , str ) : #NEWLINE# #INDENT# filename = better_fn #NEWLINE# #UNINDENT# fixed_records . append ( ( frame , filename , line_no , func_name , lines , index ) ) #NEWLINE# #UNINDENT# return fixed_records