mirror of
https://github.com/python/cpython.git
synced 2025-08-28 12:45:07 +00:00
Fix pydoc.synopsis() so that it doesn't error out with an unreadable
module.
This commit is contained in:
parent
2f5e9903a0
commit
26fd2e1dcc
1 changed files with 5 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue