diff Lib/linecache.py @ 50162:4264cf00a75c 2.6

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 ........
author Nick Coghlan <ncoghlan@gmail.com>
date Sun, 14 Dec 2008 11:30:16 +0000
parents ea3723b2d46b
children acc07866b233
line wrap: on
line diff
--- a/Lib/linecache.py	Fri Dec 12 21:25:13 2008 +0000
+++ b/Lib/linecache.py	Sun Dec 14 11:30:16 2008 +0000
@@ -88,21 +88,20 @@
             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.