Show More
@@ -220,8 +220,17 b' def findsource(object):' | |||||
220 | return lines, lnum |
|
220 | return lines, lnum | |
221 | raise IOError('could not find code object') |
|
221 | raise IOError('could not find code object') | |
222 |
|
222 | |||
223 |
# Monkeypatch inspect to apply our bugfix. |
|
223 | # Monkeypatch inspect to apply our bugfix. | |
224 | inspect.findsource = findsource |
|
224 | def with_patch_inspect(f): | |
|
225 | """decorator for monkeypatching inspect.findsource""" | |||
|
226 | def wrapped(*args, **kwargs): | |||
|
227 | save_findsource = inspect.findsource | |||
|
228 | inspect.findsource = findsource | |||
|
229 | try: | |||
|
230 | return f(*args, **kwargs) | |||
|
231 | finally: | |||
|
232 | inspect.findsource = save_findsource | |||
|
233 | return wrapped | |||
225 |
|
234 | |||
226 | def fix_frame_records_filenames(records): |
|
235 | def fix_frame_records_filenames(records): | |
227 | """Try to fix the filenames in each record from inspect.getinnerframes(). |
|
236 | """Try to fix the filenames in each record from inspect.getinnerframes(). | |
@@ -243,6 +252,7 b' def fix_frame_records_filenames(records):' | |||||
243 | return fixed_records |
|
252 | return fixed_records | |
244 |
|
253 | |||
245 |
|
254 | |||
|
255 | @with_patch_inspect | |||
246 | def _fixed_getinnerframes(etb, context=1,tb_offset=0): |
|
256 | def _fixed_getinnerframes(etb, context=1,tb_offset=0): | |
247 | LNUM_POS, LINES_POS, INDEX_POS = 2, 4, 5 |
|
257 | LNUM_POS, LINES_POS, INDEX_POS = 2, 4, 5 | |
248 |
|
258 |
General Comments 0
You need to be logged in to leave comments.
Login now