mirror of
https://github.com/python/cpython.git
synced 2025-07-29 14:15:07 +00:00
#1309567: fix linecache behavior of stripping subdirectories from paths when looking for relative filename matches. Also add a linecache test suite.
This commit is contained in:
parent
f71ba95e91
commit
7c26d76d9c
2 changed files with 134 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue