This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: bug in rlcompleter
Type: behavior Stage:
Components: Library (Lib) Versions: Python 2.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: donlorenzo, georg.brandl
Priority: normal Keywords: easy, patch

Created on 2008-03-03 10:49 by donlorenzo, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
rlcompleter.patch donlorenzo, 2008-03-03 10:49 patch that fixes the bug
Messages (3)
msg63208 - (view) Author: Lorenz Quack (donlorenzo) * Date: 2008-03-03 10:49
The following code would raise a TypeError:
>>> rlcompleter.Completer().complete("print self.foo", 0)
with this fix it will just return None
msg63212 - (view) Author: Lorenz Quack (donlorenzo) * Date: 2008-03-03 14:01
Some more information:
the dot in the example causes complete() to call self.attr_matches(text)
which in turn performes the following call
re.match(r"(\w+(\.\w+)*)\.(\w*)", text)
and return None if there is no match.
the complete method unconditionally accesses the return value like a
list via
matches[state]
which raises the TypeError.
The obvious solution was to return an empty list instead of None which
is also the behaviour in all other cases where no completion is found.
msg63312 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2008-03-06 07:46
Fixed in r61275, r61276 (2.5).
History
Date User Action Args
2022-04-11 14:56:31adminsetgithub: 46473
2008-03-06 07:46:43georg.brandlsetstatus: open -> closed
resolution: fixed
messages: + msg63312
nosy: + georg.brandl
2008-03-05 16:35:37akuchlingsetkeywords: + easy
2008-03-03 22:09:23benjamin.petersonsettype: crash -> behavior
2008-03-03 14:01:33donlorenzosetmessages: + msg63212
2008-03-03 10:49:38donlorenzocreate