diff options
author | Georg Brandl <georg@python.org> | 2006-03-08 09:34:57 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2006-03-08 09:34:57 (GMT) |
commit | 865ddfb7c5ae64626cb30d011e77d32f12f55a8e (patch) | |
tree | c694d7e7330d001acb7747f73d6ae40ef0d466aa /Lib/pydoc.py | |
parent | 360641c6e36d5a61e74f805b03b572a7beb41032 (diff) | |
download | cpython-865ddfb7c5ae64626cb30d011e77d32f12f55a8e.zip cpython-865ddfb7c5ae64626cb30d011e77d32f12f55a8e.tar.gz cpython-865ddfb7c5ae64626cb30d011e77d32f12f55a8e.tar.bz2 |
Fix pydoc.synopsis() so that it doesn't error out with an unreadable
module.
(backport from rev. 42912)
Diffstat (limited to 'Lib/pydoc.py')
-rwxr-xr-x | Lib/pydoc.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/pydoc.py b/Lib/pydoc.py index 0569826..fca4e09 100755 --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -179,7 +179,11 @@ def synopsis(filename, cache={}): lastupdate, result = cache.get(filename, (0, None)) if lastupdate < mtime: info = inspect.getmoduleinfo(filename) - file = open(filename) + try: + file = open(filename) + except IOError: + # module can't be opened, so skip it + return None if info and 'b' in info[2]: # binary modules have to be imported try: module = imp.load_module('__temp__', file, filename, info[1:]) except: return None |