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.
|