diff options
author | Nick Coghlan <ncoghlan@gmail.com> | 2008-12-14 10:54:50 (GMT) |
---|---|---|
committer | Nick Coghlan <ncoghlan@gmail.com> | 2008-12-14 10:54:50 (GMT) |
commit | a2053475bb8a908e1cc80c765e02c98a6f354b19 (patch) | |
tree | 8449947a38952aaf7e64a7320c58fedf85fa07db /Lib/linecache.py | |
parent | 3e16f3dd7f9219a19e5802b721b19fde93fc56a5 (diff) | |
download | cpython-a2053475bb8a908e1cc80c765e02c98a6f354b19.zip cpython-a2053475bb8a908e1cc80c765e02c98a6f354b19.tar.gz cpython-a2053475bb8a908e1cc80c765e02c98a6f354b19.tar.bz2 |
Fix several issues relating to access to source code inside zipfiles. Initial work by Alexander Belopolsky. See Misc/NEWS in this checkin for details.
Diffstat (limited to 'Lib/linecache.py')
-rw-r--r-- | Lib/linecache.py | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/Lib/linecache.py b/Lib/linecache.py index 4838625..48f7dda 100644 --- a/Lib/linecache.py +++ b/Lib/linecache.py @@ -88,21 +88,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. |