Skip to content

Commit

Permalink
Fix pydoc.synopsis() so that it doesn't error out with an unreadable
Browse files Browse the repository at this point in the history
module.
  • Loading branch information
birkenfeld committed Mar 8, 2006
1 parent 2f5e990 commit 26fd2e1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Lib/pydoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,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
Expand Down

0 comments on commit 26fd2e1

Please sign in to comment.