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