- #2250: Exceptions raised during evaluation of names in rlcompleter's

``Completer.complete()`` method are now caught and ignored.
This commit is contained in:
Georg Brandl 2008-05-11 21:03:42 +00:00
parent ecbbd94e71
commit 627a666db0
3 changed files with 9 additions and 2 deletions

View File

@ -61,5 +61,6 @@ Completer objects have the following method:
If called for a dotted name, it will try to evaluate anything without obvious If called for a dotted name, it will try to evaluate anything without obvious
side-effects (functions will not be evaluated, but it can generate calls to side-effects (functions will not be evaluated, but it can generate calls to
:meth:`__getattr__`) up to the last part, and find matches for the rest via the :meth:`__getattr__`) up to the last part, and find matches for the rest via the
:func:`dir` function. :func:`dir` function. Any exception raised during the evaluation of the
expression is caught, silenced and :const:`None` is returned.

View File

@ -127,7 +127,10 @@ class Completer:
if not m: if not m:
return [] return []
expr, attr = m.group(1, 3) expr, attr = m.group(1, 3)
try:
object = eval(expr, self.namespace) object = eval(expr, self.namespace)
except Exception:
return []
words = dir(object) words = dir(object)
if hasattr(object,'__class__'): if hasattr(object,'__class__'):
words.append('__class__') words.append('__class__')

View File

@ -23,6 +23,9 @@ Extension Modules
Library Library
------- -------
- #2250: Exceptions raised during evaluation of names in rlcompleter's
``Completer.complete()`` method are now caught and ignored.
- #2659: Added ``break_on_hyphens`` option to textwrap TextWrapper class. - #2659: Added ``break_on_hyphens`` option to textwrap TextWrapper class.
- The mhlib module has been deprecated for removal in Python 3.0. - The mhlib module has been deprecated for removal in Python 3.0.