This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: IDLE 3.3 Restart Shell command fails
Type: behavior Stage: resolved
Components: IDLE Versions: Python 3.3
process
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 2022-04-11 14:57 by admin. This issue is now closed.

Files
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/__init__.py", line 1397, in __call__
    return self.func(*args)
  File "Lib/idlelib/PyShell.py", line 1180, in restart_shell
    self.interp.restart_subprocess()
  File "Lib/idlelib/PyShell.py", line 429, in restart_subprocess
    self.rpcclt.accept()
  File "Lib/idlelib/rpc.py", line 525, in accept
    working_sock, address = self.listening_sock.accept()
  File "Lib/socket.py", 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/run.py", 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
http://hg.python.org/cpython/rev/ce483d696c06
History
Date User Action Args
2022-04-11 14:57:23adminsetgithub: 57509
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