summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2001-05-29 04:27:01 (GMT)
committerTim Peters <tim.peters@gmail.com>2001-05-29 04:27:01 (GMT)
commit12f21ae07f56611926ec06bd92681e771d29968f (patch)
treea58556814b36a09c68838aa5a017d8a5415cda6e /Lib
parent4324aa3572f123883e67a807b633b3d0d452a267 (diff)
downloadcpython-12f21ae07f56611926ec06bd92681e771d29968f.zip
cpython-12f21ae07f56611926ec06bd92681e771d29968f.tar.gz
cpython-12f21ae07f56611926ec06bd92681e771d29968f.tar.bz2
Patch from Gordon McMillan.
updatecache(): When using imputil, sys.path may contain things other than strings. Ignore such things instead of blowing up. Hard to say whether this is a bugfix or a feature ...
Diffstat (limited to 'Lib')
-rw-r--r--Lib/linecache.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/Lib/linecache.py b/Lib/linecache.py
index d6fc28c..cd3e50d 100644
--- a/Lib/linecache.py
+++ b/Lib/linecache.py
@@ -69,15 +69,22 @@ def updatecache(filename):
try:
stat = os.stat(fullname)
except os.error, msg:
- # Try looking through the module search path
+ # Try looking through the module search path.
basename = os.path.split(filename)[1]
for dirname in sys.path:
- fullname = os.path.join(dirname, basename)
+ # When using imputil, sys.path may contain things other than
+ # strings; ignore them when it happens.
try:
- stat = os.stat(fullname)
- break
- except os.error:
+ fullname = os.path.join(dirname, basename)
+ except (TypeError, AttributeError):
+ # Not sufficiently string-like to do anything useful with.
pass
+ else:
+ try:
+ stat = os.stat(fullname)
+ break
+ except os.error:
+ pass
else:
# No luck
## print '*** Cannot stat', filename, ':', msg