summaryrefslogtreecommitdiffstats
path: root/Lib/linecache.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/linecache.py')
-rw-r--r--Lib/linecache.py29
1 files changed, 14 insertions, 15 deletions
diff --git a/Lib/linecache.py b/Lib/linecache.py
index 50a0c1b..6a9535e 100644
--- a/Lib/linecache.py
+++ b/Lib/linecache.py
@@ -89,21 +89,20 @@ def updatecache(filename, module_globals=None):
get_source = getattr(loader, 'get_source', None)
if name and get_source:
- if basename.startswith(name.split('.')[-1]+'.'):
- try:
- data = get_source(name)
- except (ImportError, IOError):
- pass
- else:
- if data is None:
- # No luck, the PEP302 loader cannot find the source
- # for this module.
- return []
- cache[filename] = (
- len(data), None,
- [line+'\n' for line in data.splitlines()], fullname
- )
- return cache[filename][2]
+ try:
+ data = get_source(name)
+ except (ImportError, IOError):
+ pass
+ else:
+ if data is None:
+ # No luck, the PEP302 loader cannot find the source
+ # for this module.
+ return []
+ cache[filename] = (
+ len(data), None,
+ [line+'\n' for line in data.splitlines()], fullname
+ )
+ return cache[filename][2]
# Try looking through the module search path.