Commit c7cf6f55 authored by Jérome Perrin's avatar Jérome Perrin

linecache: add support for ipython >= 3

parent c0a9551e
...@@ -107,6 +107,14 @@ def patch_linecache(): ...@@ -107,6 +107,14 @@ def patch_linecache():
if isinstance(m, str) and 'linecache' in m: if isinstance(m, str) and 'linecache' in m:
frame = frame.f_back frame = frame.f_back
m = frame.f_globals['__name__'] m = frame.f_globals['__name__']
if m == 'IPython.utils.ulinecache':
frame = frame.f_back
m = frame.f_globals['__name__']
# IPython.utils.ulinecache.getline (used in `list` pdb command) call IPython.utils.ulinecache.getlines
# so we may have two frames in IPython.utils.ulinecache module
if m == 'IPython.utils.ulinecache':
frame = frame.f_back
m = frame.f_globals['__name__']
if m == 'IPython.core.debugger': if m == 'IPython.core.debugger':
co_name = frame.f_code.co_name co_name = frame.f_code.co_name
if co_name == 'format_stack_entry': if co_name == 'format_stack_entry':
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment