[New-bugs-announce] [issue15383] Autocompletion crashes Python if the __builtins__ module cannot be found.
Tyler Crompton
report at bugs.python.org
Wed Jul 18 07:08:42 CEST 2012
New submission from Tyler Crompton <gtr053 at gmail.com>:
Doing one of the following crashes Python.
del __builtins__
a{Tab}
or
builtins = __builtins__
del __builtins__
a{Tab}
If you do a print screen, immediately, you will see the following error:
*** Internal Error: rpc.py:SocketIO.localcall()
Object: exec
Method: <bound method Executive.get_the_completion_list of <idlelib.run.Executive object at 0x0000000002DC2710>>
Args: ('', 1)
Traceback (most recent call last):
File "C:\Python32\lib\idlelib\rpc.py", line 188, in localcall
ret = method(*args, **kwargs)
File "C:\Python32\lib\idlelib\run.py", line 327, in get_the_completion_list
return self.autocomplete.fetch_completions(what, mode)
File "C:\Python32\lib\idlelib\AutoComplete.py", line 189, in fetch_completions
namespace.update(__main__.__builtins__.__dict__)
AttributeError: 'module' object has no attribute '__builtins__'
Additionally, when __builtins__ is deleted (in IDLE), __builtins__ becomes a dictionary. If one were to then do __builtins__.clear(), the interpreter stops all interpreting. IDLE moreorless becomes a text editor with syntax highlighting. If you try to use autocomplete, Python hangs before crashing.
I realize that doing such is pointless, but it behaves differently than interactive console interpreters. Interactive console interpreters don't convert __builtins__ to a dictionary upon its deletion. I feel that this error can be handled to prevent crashing.
----------
components: IDLE
messages: 165741
nosy: Tyler.Crompton
priority: normal
severity: normal
status: open
title: Autocompletion crashes Python if the __builtins__ module cannot be found.
type: crash
versions: Python 3.2
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15383>
_______________________________________
More information about the New-bugs-announce
mailing list