From: Ronald Oussoren Date: Tue, 13 Jun 2006 11:19:56 +0000 (+0000) Subject: Linecache contains support for PEP302 loaders, but fails to deal with loaders X-Git-Tag: v2.5b1~88 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9015b938cb2232c233a925e580b6a42f0066d08c;p=python Linecache contains support for PEP302 loaders, but fails to deal with loaders that return None to indicate that the module is valid but no source is available. This patch fixes that. --- diff --git a/Lib/linecache.py b/Lib/linecache.py index f49695ac1c..4838625f08 100644 --- a/Lib/linecache.py +++ b/Lib/linecache.py @@ -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