Title: IDLE 3.3 Restart Shell command fails
Type: behavior Stage: resolved
Components: IDLE Versions: Python 3.3
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: ned.deily Nosy List: amaury.forgeotdarc, ned.deily, python-dev, terry.reedy
Priority: normal Keywords: patch

Created on 2011-10-31 02:06 by ned.deily, last changed 2011-11-06 05:39 by ned.deily. This issue is now closed.

File name Uploaded Description Edit
issue13300-3x.patch ned.deily, 2011-10-31 02:13 review
Messages (2)
msg146672 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2011-10-31 02:06
Currently in the default (pre-3.3) branch, IDLE fails if its Restart Shell command is attempted:

Exception in Tkinter callback
Traceback (most recent call last):
  File "Lib/tkinter/", line 1397, in __call__
    return self.func(*args)
  File "Lib/idlelib/", line 1180, in restart_shell
  File "Lib/idlelib/", line 429, in restart_subprocess
  File "Lib/idlelib/", line 525, in accept
    working_sock, address = self.listening_sock.accept()
  File "Lib/", line 134, in accept
    fd, addr = self._accept()
OSError: [Errno 9] Bad file descriptor
IDLE Subprocess: socket error: Connection refused, retrying....
IDLE Subprocess: socket error: Connection refused, retrying....

Warning (from warnings module):
  File "Lib/idlelib/", line 127
    socket_error = err
ResourceWarning: unclosed <socket.socket object, fd=3, family=2, type=1, proto=0>
IDLE Subprocess: socket error: Connection refused, retrying....

The culprit is recent changeset 3a5a0943b201 which attempted to prevent some debug ResourceWarnings during IDLE shutdown.  Adding the close override to the RPCClient class causes the listening socket to be closed when the shell is restarted but then a new listening socket is not opened.  The listening socket should only be closed when IDLE terminates, not when the subprocess is restarted.
msg147143 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2011-11-06 05:38
New changeset ce483d696c06 by Ned Deily in branch 'default':
Issue #13300: Fix IDLE Restart Shell command failure introduced by
Date User Action Args
2011-11-06 05:39:04ned.deilysetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2011-11-06 05:38:11python-devsetnosy: + python-dev
messages: + msg147143
2011-11-04 22:17:46terry.reedysetnosy: + terry.reedy
2011-10-31 02:13:30ned.deilysetfiles: + issue13300-3x.patch
keywords: + patch
stage: needs patch -> patch review
2011-10-31 02:06:38ned.deilycreate