diff options
author | Georg Brandl <georg@python.org> | 2009-05-05 08:28:49 +0000 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2009-05-05 08:28:49 +0000 |
commit | 7c26d76d9c5091bf8fb1692b5ad13bb9e3eefb4e (patch) | |
tree | 3666fc2a6996a2d4012fa7546ba02f26a2af6a9b /Lib/linecache.py | |
parent | f71ba95e9146872200bbc474337b41b0b4d964de (diff) | |
download | cpython-git-7c26d76d9c5091bf8fb1692b5ad13bb9e3eefb4e.tar.gz |
#1309567: fix linecache behavior of stripping subdirectories from paths when looking for relative filename matches. Also add a linecache test suite.
Diffstat (limited to 'Lib/linecache.py')
-rw-r--r-- | Lib/linecache.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Lib/linecache.py b/Lib/linecache.py index 48f7dda6e0..e7c33e1464 100644 --- a/Lib/linecache.py +++ b/Lib/linecache.py @@ -79,7 +79,7 @@ def updatecache(filename, module_globals=None): try: stat = os.stat(fullname) except os.error, msg: - basename = os.path.split(filename)[1] + basename = filename # Try for a __loader__, if available if module_globals and '__loader__' in module_globals: @@ -103,7 +103,10 @@ def updatecache(filename, module_globals=None): ) 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: # When using imputil, sys.path may contain things other than |