diff --git a/IPython/core/ultratb.py b/IPython/core/ultratb.py index 9e45e04..e4d4878 100644 --- a/IPython/core/ultratb.py +++ b/IPython/core/ultratb.py @@ -825,13 +825,16 @@ class VerboseTB(TBTools): call = tpl_call_fail % func # Don't attempt to tokenize binary files. - if file.endswith(('.so', '.pyd', '.dll')): - frames.append('%s %s\n' % (link,call)) - continue - - def linereader(file=file, lnum=[lnum], getline=linecache.getline): + if not file.endswith(('.py', '.pyw')): if file.endswith(('.pyc','.pyo')): + # Look up the corresponding source file. file = pyfile.source_from_cache(file) + else: + # .so, .pyd, etc. + frames.append('%s %s\n' % (link,call)) + continue + + def linereader(file=file, lnum=[lnum], getline=linecache.getline): line = getline(file, lnum[0]) lnum[0] += 1 return line