[New-bugs-announce] [issue2250] rlcompleter raises Exception on bad input

Lorenz Quack report at bugs.python.org
Fri Mar 7 11:49:57 CET 2008


New submission from Lorenz Quack:

in line 130 rlcompleter calls eval on the first part (before the last
dot) of the input text.
if that part is not valid it will raise an exception which is likely to
crash a calling application. 

example 1:
==========
import rlcompleter
rlcompleter.Completer().complete("foo.", 0) -> raises NameError

example 2:
==========
import rlcompleter
foo = 5
rlcompleter.Completer().complete("foo.bar.", 0) -> raises AttributeError

the patch puts the eval call in a try-except block and catches Name- and
AttributeErrors and returns an empty list (the behavior when no matches
are found).

----------
components: Library (Lib)
files: rlcompleter.patch
keywords: patch
messages: 63349
nosy: donlorenzo
severity: normal
status: open
title: rlcompleter raises Exception on bad input
type: behavior
versions: Python 2.5
Added file: http://bugs.python.org/file9627/rlcompleter.patch

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue2250>
__________________________________


More information about the New-bugs-announce mailing list