]> granicus.if.org Git - python/commitdiff
Linecache contains support for PEP302 loaders, but fails to deal with loaders
authorRonald Oussoren <ronaldoussoren@mac.com>
Tue, 13 Jun 2006 11:19:56 +0000 (11:19 +0000)
committerRonald Oussoren <ronaldoussoren@mac.com>
Tue, 13 Jun 2006 11:19:56 +0000 (11:19 +0000)
that return None to indicate that the module is valid but no source is
available. This patch fixes that.

Lib/linecache.py

index f49695ac1cec88c87b428e9d18a7324ffc79ce9a..4838625f08d54011a89ecbd6ef98da93c40e88a5 100644 (file)
@@ -94,6 +94,10 @@ def updatecache(filename, module_globals=None):
                     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