From db6107b16a45e5787bbab489c6b978f87ac1332f 2008-08-17 22:25:45 From: Fernando Perez Date: 2008-08-17 22:25:45 Subject: [PATCH] Fix bug in ultraTB introduced by sync-editor branch. Added check flag and made code more robust by only extracting the needed variables from records object. --- diff --git a/IPython/ultraTB.py b/IPython/ultraTB.py index 51a0eee..f6abbbd 100644 --- a/IPython/ultraTB.py +++ b/IPython/ultraTB.py @@ -459,8 +459,9 @@ class ListTB(TBTools): try: msg, (filename, lineno, offset, line) = value except: - pass + have_filedata = False else: + have_filedata = True #print 'filename is',filename # dbg if not filename: filename = "" list.append('%s File %s"%s"%s, line %s%d%s\n' % \ @@ -492,7 +493,8 @@ class ListTB(TBTools): list.append('%s\n' % str(stype)) # vds:>> - __IPYTHON__.hooks.synchronize_with_editor(filename, lineno, 0) + if have_filedata: + __IPYTHON__.hooks.synchronize_with_editor(filename, lineno, 0) # vds:<< return list @@ -809,10 +811,10 @@ class VerboseTB(TBTools): # vds: >> if records: - frame, file, lnum, func, lines, index = records[-1] - #print "file:", str(file), "linenb", str(lnum) - file = abspath(file) - __IPYTHON__.hooks.synchronize_with_editor(file, lnum, 0) + filepath, lnum = records[-1][1:3] + #print "file:", str(file), "linenb", str(lnum) # dbg + filepath = os.path.abspath(filepath) + __IPYTHON__.hooks.synchronize_with_editor(filepath, lnum, 0) # vds: << # return all our info assembled as a single string