[Python-checkins] r72035 - in python/branches/py3k: Lib/idlelib/NEWS.txt Lib/idlelib/OutputWindow.py

georg.brandl python-checkins at python.org
Mon Apr 27 18:58:05 CEST 2009


Author: georg.brandl
Date: Mon Apr 27 18:58:05 2009
New Revision: 72035

Log:
Merged revisions 71995 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r71995 | kurt.kaiser | 2009-04-27 01:22:11 +0200 (Mo, 27 Apr 2009) | 2 lines
  
  Right click 'go to file/line' not working if spaces
  in path.  Bug 5559.
........


Modified:
   python/branches/py3k/   (props changed)
   python/branches/py3k/Lib/idlelib/NEWS.txt
   python/branches/py3k/Lib/idlelib/OutputWindow.py

Modified: python/branches/py3k/Lib/idlelib/NEWS.txt
==============================================================================
--- python/branches/py3k/Lib/idlelib/NEWS.txt	(original)
+++ python/branches/py3k/Lib/idlelib/NEWS.txt	Mon Apr 27 18:58:05 2009
@@ -30,6 +30,9 @@
 
 *Release date: XX-XXX-2009*
 
+- OutputWindow/PyShell right click menu "Go to file/line" wasn't working with
+  file paths containing spaces.  Bug 5559.
+
 - Windows: Version string for the .chm help file changed, file not being
   accessed  Patch 5783 Guilherme Polo
 

Modified: python/branches/py3k/Lib/idlelib/OutputWindow.py
==============================================================================
--- python/branches/py3k/Lib/idlelib/OutputWindow.py	(original)
+++ python/branches/py3k/Lib/idlelib/OutputWindow.py	Mon Apr 27 18:58:05 2009
@@ -58,6 +58,7 @@
         r'file "([^"]*)", line (\d+)',
         r'([^\s]+)\((\d+)\)',
         r'([^\s]+):\s*(\d+):',
+        r'^\s*(\S+.*?):\s*(\d+):',  # Win path with spaces, trim leading spaces
     ]
 
     file_line_progs = None
@@ -91,17 +92,17 @@
 
     def _file_line_helper(self, line):
         for prog in self.file_line_progs:
-            m = prog.search(line)
-            if m:
-                break
+            match = prog.search(line)
+            if match:
+                filename, lineno = match.group(1, 2)
+                try:
+                    f = open(filename, "r")
+                    f.close()
+                    break
+                except IOError:
+                    continue
         else:
             return None
-        filename, lineno = m.group(1, 2)
-        try:
-            f = open(filename, "r")
-            f.close()
-        except IOError:
-            return None
         try:
             return filename, int(lineno)
         except TypeError:
@@ -134,19 +135,3 @@
                 text.tag_configure(tag, **cnf)
         text.tag_raise('sel')
         self.write = self.owin.write
-
-#class PseudoFile:
-#
-#      def __init__(self, owin, tags, mark="end"):
-#          self.owin = owin
-#          self.tags = tags
-#          self.mark = mark
-
-#      def write(self, s):
-#          self.owin.write(s, self.tags, self.mark)
-
-#      def writelines(self, l):
-#          map(self.write, l)
-
-#      def flush(self):
-#          pass


More information about the Python-checkins mailing list