| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 21bf1e2 commit 8b4c0cc
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -156,7 +156,9 @@ def fixlongargs(f, argspec): | |||
| 156 | 156 | keys = argspec[0][-len(values):] | |
| 157 | 157 | try: | |
| 158 | 158 | 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. | ||
| 160 | 162 | return | |
| 161 | 163 | signature = ''.join(src[0]) | |
| 162 | 164 | kwparsed = parsekeywordpairs(signature) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -534,9 +534,15 @@ def complete(self, tab=False): | |||
| 534 | 534 | if not self.get_args(): | |
| 535 | 535 | self.argspec = None | |
| 536 | 536 | 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: | ||
| 539 | 540 | 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 | ||
| 540 | 546 | ||
| 541 | 547 | cw = self.cw() | |
| 542 | 548 | cs = self.current_string() | |
| Back | FazBrowse Home | New Git URL |
0 commit comments