File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed
Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -156,7 +156,9 @@ def fixlongargs(f, argspec):
156156 keys = argspec [0 ][- len (values ):]
157157 try :
158158 src = inspect .getsourcelines (f )
159- except IOError :
159+ except (IOError , IndexError ):
160+ # IndexError is raised in inspect.findsource(), can happen in
161+ # some situations. See issue #94.
160162 return
161163 signature = '' .join (src [0 ])
162164 kwparsed = parsekeywordpairs (signature )
Original file line number Diff line number Diff line change @@ -534,9 +534,15 @@ def complete(self, tab=False):
534534 if not self .get_args ():
535535 self .argspec = None
536536 elif self .current_func is not None :
537- self .docstring = pydoc .getdoc (self .current_func )
538- if not self .docstring :
537+ try :
538+ self .docstring = pydoc .getdoc (self .current_func )
539+ except IndexError :
539540 self .docstring = None
541+ else :
542+ # pydoc.getdoc() returns an empty string if no
543+ # docstring was found
544+ if not self .docstring :
545+ self .docstring = None
540546
541547 cw = self .cw ()
542548 cs = self .current_string ()
You can’t perform that action at this time.
0 commit comments