[Python-checkins] r72321 - in python/branches/py3k: Lib/linecache.py Lib/test/test_linecache.py Misc/NEWS

georg.brandl python-checkins at python.org
Tue May 5 10:31:54 CEST 2009


Author: georg.brandl
Date: Tue May  5 10:31:54 2009
New Revision: 72321

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

........
  r72319 | georg.brandl | 2009-05-05 10:28:49 +0200 (Di, 05 Mai 2009) | 1 line
  
  #1309567: fix linecache behavior of stripping subdirectories from paths when looking for relative filename matches. Also add a linecache test suite.
........
  r72320 | georg.brandl | 2009-05-05 10:30:28 +0200 (Di, 05 Mai 2009) | 1 line
  
  Add a news entry for r72319.
........


Added:
   python/branches/py3k/Lib/test/test_linecache.py
      - copied, changed from r72320, /python/trunk/Lib/test/test_linecache.py
Modified:
   python/branches/py3k/   (props changed)
   python/branches/py3k/Lib/linecache.py
   python/branches/py3k/Misc/NEWS

Modified: python/branches/py3k/Lib/linecache.py
==============================================================================
--- python/branches/py3k/Lib/linecache.py	(original)
+++ python/branches/py3k/Lib/linecache.py	Tue May  5 10:31:54 2009
@@ -80,7 +80,7 @@
     try:
         stat = os.stat(fullname)
     except os.error as msg:
-        basename = os.path.split(filename)[1]
+        basename = filename
 
         # Try for a __loader__, if available
         if module_globals and '__loader__' in module_globals:
@@ -104,7 +104,10 @@
                     )
                     return cache[filename][2]
 
-        # Try looking through the module search path.
+        # Try looking through the module search path, which is only useful
+        # when handling a relative filename.
+        if os.path.isabs(filename):
+            return []
 
         for dirname in sys.path:
             try:

Copied: python/branches/py3k/Lib/test/test_linecache.py (from r72320, /python/trunk/Lib/test/test_linecache.py)
==============================================================================
--- /python/trunk/Lib/test/test_linecache.py	(original)
+++ python/branches/py3k/Lib/test/test_linecache.py	Tue May  5 10:31:54 2009
@@ -3,7 +3,7 @@
 import linecache
 import unittest
 import os.path
-from test import test_support as support
+from test import support
 
 
 FILENAME = linecache.__file__

Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS	(original)
+++ python/branches/py3k/Misc/NEWS	Tue May  5 10:31:54 2009
@@ -118,6 +118,9 @@
 Library
 -------
 
+- Issue #1309567: Fix linecache behavior of stripping subdirectories when
+  looking for files given by a relative filename.
+
 - Issue #5923: Update the ``turtle`` module to version 1.1, add two new
   turtle demos in Demo/turtle.
 


More information about the Python-checkins mailing list