##// END OF EJS Templates
Keep Cython filenames in tracebacks
Jeroen Demeyer -
Show More
@@ -245,14 +245,16 b' def fix_frame_records_filenames(records):'
245 245 """
246 246 fixed_records = []
247 247 for frame, filename, line_no, func_name, lines, index in records:
248 # Look inside the frame's globals dictionary for __file__, which should
249 # be better.
250 better_fn = frame.f_globals.get('__file__', None)
251 if isinstance(better_fn, str):
252 # Check the type just in case someone did something weird with
253 # __file__. It might also be None if the error occurred during
254 # import.
255 filename = better_fn
248 # Look inside the frame's globals dictionary for __file__,
249 # which should be better. However, keep Cython filenames since
250 # we prefer the source filenames over the compiled .so file.
251 if not filename.endswith(('.pyx', '.pxd', '.pxi')):
252 better_fn = frame.f_globals.get('__file__', None)
253 if isinstance(better_fn, str):
254 # Check the type just in case someone did something weird with
255 # __file__. It might also be None if the error occurred during
256 # import.
257 filename = better_fn
256 258 fixed_records.append((frame, filename, line_no, func_name, lines, index))
257 259 return fixed_records
258 260
General Comments 0
You need to be logged in to leave comments. Login now