summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRonald Oussoren <ronaldoussoren@mac.com>2006-06-13 11:19:56 (GMT)
committerRonald Oussoren <ronaldoussoren@mac.com>2006-06-13 11:19:56 (GMT)
commit9015b938cb2232c233a925e580b6a42f0066d08c (patch)
tree4498b70d5f84f35551a71a07a799e9f49c17910f
parentfdbebb65af31809d346592f8dbb3883ca0b7c235 (diff)
downloadcpython-9015b938cb2232c233a925e580b6a42f0066d08c.zip
cpython-9015b938cb2232c233a925e580b6a42f0066d08c.tar.gz
cpython-9015b938cb2232c233a925e580b6a42f0066d08c.tar.bz2
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.
-rw-r--r--Lib/linecache.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/linecache.py b/Lib/linecache.py
index f49695a..4838625 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