[proxy] bugs.python.org← back | site home | direct (HTTPS) ↗ | proxy home | ◑ dark◐ light

Issue 26806: IDLE not displaying RecursionError tracebacks and hangs

In 3.6 just setting the recursion level to 20 produces following output on terminal:

----------------------------------------
Unhandled server exception!
Thread: SockThread
Client Address:  ('127.0.0.1', 41515)
Unhandled exception in thread started by 

and a hang.

In 2.7 it produces:

----------------------------------------
Unhandled server exception!
Thread: SockThread
Client Address:  ('127.0.0.1', 35043)
Request:  <socket._socketobject object at 0xb70e4a84>
Traceback (most recent call last):
  File "/home/serhiy/py/cpython-2.7-debug/Lib/SocketServer.py", line 290, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/home/serhiy/py/cpython-2.7-debug/Lib/SocketServer.py", line 318, in process_request
    self.finish_request(request, client_address)
  File "/home/serhiy/py/cpython-2.7-debug/Lib/SocketServer.py", line 331, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/home/serhiy/py/cpython-2.7-debug/Lib/idlelib/rpc.py", line 500, in __init__
    SocketServer.BaseRequestHandler.__init__(self, sock, addr, svr)
  File "/home/serhiy/py/cpython-2.7-debug/Lib/SocketServer.py", line 652, in __init__
    self.handle()
  File "/home/serhiy/py/cpython-2.7-debug/Lib/idlelib/run.py", line 292, in handle
    rpc.RPCHandler.getresponse(self, myseq=None, wait=0.05)
  File "/home/serhiy/py/cpython-2.7-debug/Lib/idlelib/rpc.py", line 280, in getresponse
    response = self._getresponse(myseq, wait)
  File "/home/serhiy/py/cpython-2.7-debug/Lib/idlelib/rpc.py", line 300, in _getresponse
    response = self.pollresponse(myseq, wait)
RuntimeError: maximum recursion depth exceeded

*** Unrecoverable, server exiting!
----------------------------------------

and restarts the shell.

Definitely the 20 limit is too low for IDLE.
Experimentally found that minimal recursion level for 2.7 is 29, for 3.2-3.3 is 24, and for 3.4-3.6 is 25.

3.2 produces following output and restart the shell:

----------------------------------------
Unhandled server exception!
Thread: SockThread
Client Address:  ('127.0.0.1', 37227)
Request:  <socket.socket object, fd=3, family=2, type=1, proto=0>
Traceback (most recent call last):
  File "/home/serhiy/py/cpython-3.2/Lib/socketserver.py", line 295, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/home/serhiy/py/cpython-3.2/Lib/socketserver.py", line 321, in process_request
    self.finish_request(request, client_address)
  File "/home/serhiy/py/cpython-3.2/Lib/socketserver.py", line 334, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/home/serhiy/py/cpython-3.2/Lib/idlelib/rpc.py", line 503, in __init__
    socketserver.BaseRequestHandler.__init__(self, sock, addr, svr)
  File "/home/serhiy/py/cpython-3.2/Lib/socketserver.py", line 648, in __init__
    self.handle()
  File "/home/serhiy/py/cpython-3.2/Lib/idlelib/run.py", line 285, in handle
    rpc.RPCHandler.getresponse(self, myseq=None, wait=0.05)
  File "/home/serhiy/py/cpython-3.2/Lib/idlelib/rpc.py", line 280, in getresponse
    response = self._getresponse(myseq, wait)
  File "/home/serhiy/py/cpython-3.2/Lib/idlelib/rpc.py", line 300, in _getresponse
    response = self.pollresponse(myseq, wait)
  File "/home/serhiy/py/cpython-3.2/Lib/idlelib/rpc.py", line 421, in pollresponse
    self.putmessage(message)
  File "/home/serhiy/py/cpython-3.2/Lib/idlelib/rpc.py", line 324, in putmessage
    s = pickle.dumps(message)
RuntimeError: maximum recursion depth exceeded while pickling an object

*** Unrecoverable, server exiting!
----------------------------------------

3.3 hangs without any terminal output.

3.4 produces the most detailed output and hangs:

----------------------------------------
Unhandled server exception!
Thread: SockThread
Client Address:  ('127.0.0.1', 46394)
Request:  <socket.socket fd=6, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('127.0.0.1', 48776), raddr=('127.0.0.1', 46394)>
Traceback (most recent call last):
Exception in thread SockThread:
Traceback (most recent call last):
  File "/home/serhiy/py/cpython-3.4/Lib/socketserver.py", line 305, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/home/serhiy/py/cpython-3.4/Lib/socketserver.py", line 331, in process_request
    self.finish_request(request, client_address)
  File "/home/serhiy/py/cpython-3.4/Lib/socketserver.py", line 344, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/home/serhiy/py/cpython-3.4/Lib/idlelib/rpc.py", line 508, in __init__
    socketserver.BaseRequestHandler.__init__(self, sock, addr, svr)
  File "/home/serhiy/py/cpython-3.4/Lib/socketserver.py", line 673, in __init__
    self.handle()
  File "/home/serhiy/py/cpython-3.4/Lib/idlelib/run.py", line 318, in handle
    rpc.RPCHandler.getresponse(self, myseq=None, wait=0.05)
  File "/home/serhiy/py/cpython-3.4/Lib/idlelib/rpc.py", line 288, in getresponse
    response = self._getresponse(myseq, wait)
  File "/home/serhiy/py/cpython-3.4/Lib/idlelib/rpc.py", line 308, in _getresponse
    response = self.pollresponse(myseq, wait)
  File "/home/serhiy/py/cpython-3.4/Lib/idlelib/rpc.py", line 426, in pollresponse
    self.putmessage(message)
  File "/home/serhiy/py/cpython-3.4/Lib/idlelib/rpc.py", line 332, in putmessage
    s = dumps(message)
  File "/home/serhiy/py/cpython-3.4/Lib/idlelib/rpc.py", line 60, in dumps
    p.dump(obj)
RuntimeError: maximum recursion depth exceeded while pickling an object

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/serhiy/py/cpython-3.4/Lib/threading.py", line 911, in _bootstrap_inner
    self.run()
  File "/home/serhiy/py/cpython-3.4/Lib/threading.py", line 859, in run
    self._target(*self._args, **self._kwargs)
  File "/home/serhiy/py/cpython-3.4/Lib/idlelib/run.py", line 162, in manage_socket
    server.handle_request() # A single request only
  File "/home/serhiy/py/cpython-3.4/Lib/socketserver.py", line 290, in handle_request
    self._handle_request_noblock()
  File "/home/serhiy/py/cpython-3.4/Lib/socketserver.py", line 307, in _handle_request_noblock
    self.handle_error(request, client_address)
  File "/home/serhiy/py/cpython-3.4/Lib/idlelib/run.py", line 288, in handle_error
    traceback.print_exc(file=erf)
  File "/home/serhiy/py/cpython-3.4/Lib/traceback.py", line 252, in print_exc
    print_exception(*sys.exc_info(), limit=limit, file=file, chain=chain)
  File "/home/serhiy/py/cpython-3.4/Lib/traceback.py", line 169, in print_exception
    for line in _format_exception_iter(etype, value, tb, limit, chain):
  File "/home/serhiy/py/cpython-3.4/Lib/traceback.py", line 153, in _format_exception_iter
    yield from _format_list_iter(_extract_tb_iter(tb, limit=limit))
  File "/home/serhiy/py/cpython-3.4/Lib/traceback.py", line 18, in _format_list_iter
    for filename, lineno, name, line in extracted_list:
  File "/home/serhiy/py/cpython-3.4/Lib/traceback.py", line 65, in _extract_tb_or_stack_iter
    line = linecache.getline(filename, lineno, f.f_globals)
  File "/home/serhiy/py/cpython-3.4/Lib/linecache.py", line 15, in getline
    lines = getlines(filename, module_globals)
  File "/home/serhiy/py/cpython-3.4/Lib/linecache.py", line 42, in getlines
    return updatecache(filename, module_globals)
  File "/home/serhiy/py/cpython-3.4/Lib/linecache.py", line 130, in updatecache
    with tokenize.open(fullname) as fp:
  File "/home/serhiy/py/cpython-3.4/Lib/tokenize.py", line 458, in open
    text = TextIOWrapper(buffer, encoding, line_buffering=True)
RuntimeError: maximum recursion depth exceeded

3.5 and 3.6 behaves as was described in msg263795.