diff options
| author | Martin Panter <vadmium+py@gmail.com> | 2015-11-24 00:10:45 (GMT) |
|---|---|---|
| committer | Martin Panter <vadmium+py@gmail.com> | 2015-11-24 00:10:45 (GMT) |
| commit | 11bb1ad15502849f126af3f35de7eaeebd617fc5 (patch) | |
| tree | 640d8bc75c1950df2ef4da0039ca7013f963495f /Lib/rlcompleter.py | |
| parent | 1f847659f33ee3d51db3cb85cf408b5bba696347 (diff) | |
| parent | ed92910852ad7a3006bc264ef6cb061868e5a82c (diff) | |
| download | cpython-11bb1ad15502849f126af3f35de7eaeebd617fc5.zip cpython-11bb1ad15502849f126af3f35de7eaeebd617fc5.tar.gz cpython-11bb1ad15502849f126af3f35de7eaeebd617fc5.tar.bz2 | |
Issue #25663: Merge rlcompleter fix from 3.4 into 3.5
Diffstat (limited to 'Lib/rlcompleter.py')
| -rw-r--r-- | Lib/rlcompleter.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Lib/rlcompleter.py b/Lib/rlcompleter.py index be8aee0..378f5aa 100644 --- a/Lib/rlcompleter.py +++ b/Lib/rlcompleter.py @@ -103,13 +103,16 @@ class Completer: """ import keyword matches = [] + seen = {"__builtins__"} n = len(text) for word in keyword.kwlist: if word[:n] == text: + seen.add(word) matches.append(word) - for nspace in [builtins.__dict__, self.namespace]: + for nspace in [self.namespace, builtins.__dict__]: for word, val in nspace.items(): - if word[:n] == text and word != "__builtins__": + if word[:n] == text and word not in seen: + seen.add(word) matches.append(self._callable_postfix(val, word)) return matches |
