summaryrefslogtreecommitdiff
path: root/Lib/linecache.py
diff options
context:
space:
mode:
authorNick Coghlan <ncoghlan@gmail.com>2008-12-14 11:50:48 +0000
committerNick Coghlan <ncoghlan@gmail.com>2008-12-14 11:50:48 +0000
commit5e652d66c87252f3741539a15fc2227d67c1099b (patch)
tree7a90379735b20faa40d3036b89e21e8063c50bce /Lib/linecache.py
parentee1414027a5615b7aeafdd9018c0d3248227b253 (diff)
downloadcpython-5e652d66c87252f3741539a15fc2227d67c1099b.tar.gz
Merged revisions 67750-67751 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r67750 | nick.coghlan | 2008-12-14 20:54:50 +1000 (Sun, 14 Dec 2008) | 1 line Fix several issues relating to access to source code inside zipfiles. Initial work by Alexander Belopolsky. See Misc/NEWS in this checkin for details. ........ r67751 | nick.coghlan | 2008-12-14 21:09:40 +1000 (Sun, 14 Dec 2008) | 1 line Add file that was missed from r67750 ........
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 50a0c1b480..6a9535ed1f 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.