Commit 12f21ae0 authored by Tim Peters's avatar Tim Peters

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 ...
parent 4324aa35
...@@ -69,15 +69,22 @@ def updatecache(filename): ...@@ -69,15 +69,22 @@ def updatecache(filename):
try: try:
stat = os.stat(fullname) stat = os.stat(fullname)
except os.error, msg: except os.error, msg:
# Try looking through the module search path # Try looking through the module search path.
basename = os.path.split(filename)[1] basename = os.path.split(filename)[1]
for dirname in sys.path: 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: try:
stat = os.stat(fullname) fullname = os.path.join(dirname, basename)
break except (TypeError, AttributeError):
except os.error: # Not sufficiently string-like to do anything useful with.
pass pass
else:
try:
stat = os.stat(fullname)
break
except os.error:
pass
else: else:
# No luck # No luck
## print '*** Cannot stat', filename, ':', msg ## print '*** Cannot stat', filename, ':', msg
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment