[Python-checkins] r46912 - python/trunk/Lib/linecache.py

ronald.oussoren python-checkins at python.org
Tue Jun 13 13:19:57 CEST 2006


Author: ronald.oussoren
Date: Tue Jun 13 13:19:56 2006
New Revision: 46912

Modified:
   python/trunk/Lib/linecache.py
Log:
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.


Modified: python/trunk/Lib/linecache.py
==============================================================================
--- python/trunk/Lib/linecache.py	(original)
+++ python/trunk/Lib/linecache.py	Tue Jun 13 13:19:56 2006
@@ -94,6 +94,10 @@
                     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


More information about the Python-checkins mailing list