[New-bugs-announce] [issue22143] rlcompleter.Completer has duplicate matches

Lorenz Quack report at bugs.python.org
Tue Aug 5 18:13:15 CEST 2014

New submission from Lorenz Quack:

>>> import rlcompleter
>>> completer = rlcompleter.Completer()
>>> class A(object):
...     foo = None
>>> class B(A):
...     pass
>>> b = B()
>>> print([completer.complete("b.foo", i) for i in range(4)])
['b.foo', 'b.foo', 'b.foo', None]

I would expect the completions to be unique.
This happens because the possible words to match are put into a list.
A possible fix is putting them into a set instead.
Patch attached.

components: Library (Lib)
files: rlcompleter.diff
keywords: patch
messages: 224852
nosy: donlorenzo
priority: normal
severity: normal
status: open
title: rlcompleter.Completer has duplicate matches
versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4, Python 3.5
Added file: http://bugs.python.org/file36268/rlcompleter.diff

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list