python / cpython

The Python programming language
https://www.python.org
Other
62.95k stars 30.14k forks source link

IDLE server crash while I'm ruining __builtins__ #113936

Closed 00001H closed 9 months ago

00001H commented 9 months ago

Bug report

Bug description:

>>> __builtins__.__import__ = None
>>> import a

----------------------------------------
Unhandled exception in user code execution server!'
Thread: SockThread
IDLE Client Address: ('127.0.0.1', 50162)
Request: <socket.socket fd=696, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('127.0.0.1', 50163), raddr=('127.0.0.1', 50162)>

Traceback (most recent call last):
  File "E:\Python310\lib\socketserver.py", line 316, in _handle_request_noblock
    self.process_request(request, client_address)
  File "E:\Python310\lib\socketserver.py", line 347, in process_request
    self.finish_request(request, client_address)
  File "E:\Python310\lib\socketserver.py", line 360, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "E:\Python310\lib\idlelib\rpc.py", line 514, in __init__
    socketserver.BaseRequestHandler.__init__(self, sock, addr, svr)
  File "E:\Python310\lib\socketserver.py", line 747, in __init__
    self.handle()
  File "E:\Python310\lib\idlelib\run.py", line 542, in handle
    rpc.RPCHandler.getresponse(self, myseq=None, wait=0.05)
  File "E:\Python310\lib\idlelib\rpc.py", line 291, in getresponse
    response = self._getresponse(myseq, wait)
  File "E:\Python310\lib\idlelib\rpc.py", line 311, in _getresponse
    response = self.pollresponse(myseq, wait)
  File "E:\Python310\lib\idlelib\rpc.py", line 432, in pollresponse
    message = self.pollmessage(wait)
  File "E:\Python310\lib\idlelib\rpc.py", line 388, in pollmessage
    message = pickle.loads(packet)
TypeError: 'NoneType' object is not callable

*** Unrecoverable, server exiting!

Users should never see this message; it is likely transient.
If this recurs, report this with a copy of the message
and an explanation of how to make it repeat.
----------------------------------------

CPython versions tested on:

3.10

Operating systems tested on:

Windows

00001H commented 9 months ago

https://github.com/python/cpython/labels/3.10 https://github.com/python/cpython/labels/topic-IDLE

ericvsmith commented 9 months ago

I'm not clear why you would expect this to work. You can cause any number of failures if you mess around with dunder variables, especially in builtins. What were you trying to accomplish?

AA-Turner commented 9 months ago

I think this bears simply closing — if you violate the consenting adults principle, bad things tend to happen!

A

terryjreedy commented 9 months ago

I added type RPC draft issue "Handle execution process failure better" to IDLE issues project.