[New-bugs-announce] [issue22141] rlcompleter.Completer matches too much
Lorenz Quack
report at bugs.python.org
Tue Aug 5 17:59:59 CEST 2014
New submission from Lorenz Quack:
Example:
>>> completer = rlcompleter.Completer()
>>> class A(object):
... def foo(): pass
... def foobar(): pass
>>> completer.complete("A.foo(", 0)
'A.foo('
>>> completer.complete("A.foo(", 1)
'A.foobar('
I consider the last match a bug.
The root of this bug is that in attr_matches the regular expression ignores any trailing non-alphanumeric characters by using the "\w" sequence. Note that it would also match "A.foo?%&@" to both "A.foo" and "A.foobar".
I propose this regex instead:
r"(\w+(\.\w+)*)\.([^.]*)"
What do people think?
----------
components: Library (Lib)
messages: 224848
nosy: donlorenzo
priority: normal
severity: normal
status: open
title: rlcompleter.Completer matches too much
type: behavior
versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4, Python 3.5
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22141>
_______________________________________
More information about the New-bugs-announce
mailing list