From 9015b938cb2232c233a925e580b6a42f0066d08c Mon Sep 17 00:00:00 2001 From: Ronald Oussoren Date: Tue, 13 Jun 2006 11:19:56 +0000 Subject: [PATCH] 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. --- Lib/linecache.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Lib/linecache.py b/Lib/linecache.py index f49695ac1ce..4838625f08d 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