D.V.N.Sarma డి.వి.ఎన్.శర్మ wrote: > Can somebody tell me why my IDLE hangs when asked setrecursionlimit. > >>>> x=GetSet(40) >>>> x.var > 40 >>>> x.__dict__ > {'var': 40} >>>> del x.var >>>> x.__dict__ > {} >>>> import sys >>>> sys.setrecursionlimit(7)
IDLE's commandline emulation needs the stack you just drastically reduced in size to communicate with the GUI. It looks like the code is not written to expect and cope with such a communication problem. When I start IDLE from the commandline and try a slightly higher value Python 2.7.6 (default, Jun 22 2015, 17:58:13) [GCC 4.8.2] on linux2 Type "copyright", "credits" or "license()" for more information. >>> import sys; sys.setrecursionlimit(25) >>> ================================ RESTART ================================ I see the following $ idle ---------------------------------------- Unhandled server exception! Thread: SockThread Client Address: ('127.0.0.1', 51058) Request: <socket._socketobject object at 0x7fc9b89ebb40> Traceback (most recent call last): File "/usr/lib/python2.7/SocketServer.py", line 295, in _handle_request_noblock self.process_request(request, client_address) File "/usr/lib/python2.7/SocketServer.py", line 321, in process_request self.finish_request(request, client_address) File "/usr/lib/python2.7/SocketServer.py", line 334, in finish_request self.RequestHandlerClass(request, client_address, self) File "/usr/lib/python2.7/idlelib/rpc.py", line 503, in __init__ SocketServer.BaseRequestHandler.__init__(self, sock, addr, svr) File "/usr/lib/python2.7/SocketServer.py", line 649, in __init__ self.handle() File "/usr/lib/python2.7/idlelib/run.py", line 291, in handle rpc.RPCHandler.getresponse(self, myseq=None, wait=0.05) File "/usr/lib/python2.7/idlelib/rpc.py", line 280, in getresponse response = self._getresponse(myseq, wait) File "/usr/lib/python2.7/idlelib/rpc.py", line 300, in _getresponse response = self.pollresponse(myseq, wait) File "/usr/lib/python2.7/idlelib/rpc.py", line 415, in pollresponse qmsg = response_queue.get(0) File "/usr/lib/python2.7/Queue.py", line 164, in get if not self._qsize(): RuntimeError: maximum recursion depth exceeded *** Unrecoverable, server exiting! ---------------------------------------- When I continue to use smaller stack sizes at >>> ================================ RESTART ================================ >>> import sys; sys.setrecursionlimit(17) I get Unhandled server exception! Thread: SockThread Client Address: ('127.0.0.1', 51058) Request: <socket._socketobject object at 0x7fe1b3f3eb40> Traceback (most recent call last): File "/usr/lib/python2.7/SocketServer.py", line 295, in _handle_request_noblock Unhandled exception in thread started by and IDLE indeed hangs. _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor