summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1998-06-12 19:42:14 (GMT)
committerGuido van Rossum <guido@python.org>1998-06-12 19:42:14 (GMT)
commitd458faadc303cef6fd07b9e22bfa9e08456426cf (patch)
treee04802a411c2aa9fe7a1106defef9b972811fa67 /Lib
parentb3f9f4b729ae70dc97c8855feafafc2d66c9f9fd (diff)
downloadcpython-d458faadc303cef6fd07b9e22bfa9e08456426cf.zip
cpython-d458faadc303cef6fd07b9e22bfa9e08456426cf.tar.gz
cpython-d458faadc303cef6fd07b9e22bfa9e08456426cf.tar.bz2
In completer(), return None instead of raising an IndexError when
there are no more completions left. (This for compatibility with Donald Beaudry's code.)
Diffstat (limited to 'Lib')
-rw-r--r--Lib/rlcompleter.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/rlcompleter.py b/Lib/rlcompleter.py
index e0ae72c..92633ab 100644
--- a/Lib/rlcompleter.py
+++ b/Lib/rlcompleter.py
@@ -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.