]> granicus.if.org Git - python/commitdiff
In completer(), return None instead of raising an IndexError when
authorGuido van Rossum <guido@python.org>
Fri, 12 Jun 1998 19:42:14 +0000 (19:42 +0000)
committerGuido van Rossum <guido@python.org>
Fri, 12 Jun 1998 19:42:14 +0000 (19:42 +0000)
there are no more completions left.  (This for compatibility with
Donald Beaudry's code.)

Lib/rlcompleter.py

index e0ae72c9aca3f2b94ed37428cc1d26d8253705d7..92633abbc2fbcecb2c0981edb95ce7b4878b9300 100644 (file)
@@ -58,7 +58,10 @@ class Completer:
                 self.matches = self.attr_matches(text)
             else:
                 self.matches = self.global_matches(text)
-        return self.matches[state]
+        try:
+            return self.matches[state]
+        except IndexError:
+            return None
 
     def global_matches(self, text):
         """Compute matches when text is a simple name.