classification
Title: Error on leaving IDLE with quit() or exit() under Linux
Type: behavior Stage: test needed
Components: IDLE Versions: Python 3.3, Python 3.2, Python 3.1
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Boris.FELD, ajaksu2, gerluijten, gpolo, serwy, srid
Priority: normal Keywords: patch

Created on 2009-03-15 12:44 by gerluijten, last changed 2011-12-22 19:19 by serwy.

Files
File name Uploaded Description Edit
issue5492.patch serwy, 2011-12-22 19:19 review
Messages (6)
msg83629 - (view) Author: Ger Luijten (gerluijten) Date: 2009-03-15 12:44
Hello developers,

Found a small error when using IDLE Version 3.1a1 under Kubuntu Linux
8.10 in the terminal.
Kubuntu is fully updated and no installation errors for Python 3.1a1.

See the listing from my installation notes below.

Greetings, Ger


Let's see if IDLE works, by starting it in the terminal:
$ idle

IDLE works in the new Python version 3.1a1, but there is an error!

When leaving IDLE with quit() or exit() and clicking the OK button for
the question 'The program is still running! Do you want to kill it?
there's the errors listed below, that does not occur when leaving IDLE
with Ctrl-D instead of quit():

Error when leaving with quit() (Full error listing)
*** Internal Error: rpc.py:SocketIO.localcall()

 Object: stderr
 Method: <bound method PseudoFile.write of <idlelib.PyShell.PseudoFile
object at 0x9ce942c>>
 Args: ('Traceback (most recent call last):',)

Traceback (most recent call last):
  File "/usr/local/lib/python3.1/idlelib/rpc.py", line 188, in localcall
    ret = method(*args, **kwargs)
  File "/usr/local/lib/python3.1/idlelib/PyShell.py", line 1218, in write
    self.shell.write(s, self.tags)
  File "/usr/local/lib/python3.1/idlelib/PyShell.py", line 1201, in write
    self.text.mark_gravity("iomark", "left")
AttributeError: 'NoneType' object has no attribute 'mark_gravity'

Error when leaving with exit() (Partial error listing: only the error
part that difffers is listed here)
 Object: stderr
 Method: <bound method PseudoFile.write of <idlelib.PyShell.PseudoFile
object at 0xa08642c>>
 Args: ('  File "<pyshell#0>", line 1, in <module>\n',)
msg86624 - (view) Author: Daniel Diniz (ajaksu2) Date: 2009-04-26 22:21
Cannot confirm on Kubuntu 8.04, Python 3.1a2+ built from source,
tkinter.TkVersion is 8.5.
msg89368 - (view) Author: Guilherme Polo (gpolo) * (Python committer) Date: 2009-06-14 20:22
I can get a similar error from time to time, just try it a couple of
times and I believe you should hit it too.

When that error isn't thrown IDLE prints the traceback of a SystemExit
exception inside IDLE right before closing, so it may be hard to notice.

The error I am able to get (using 3.1rc2+ r73431):


*** Internal Error: rpc.py:SocketIO.localcall()

 Object: stderr 
 Method: <bound method PseudoFile.write of <idlelib.PyShell.PseudoFile
object at 0x8b6084c>> 
 Args: ('SystemExit: None\n',)

Traceback (most recent call last):
  File "/home/gpolo/python-dev/py3k/Lib/idlelib/rpc.py", line 188, in
localcall
    ret = method(*args, **kwargs)
  File "/home/gpolo/python-dev/py3k/Lib/idlelib/PyShell.py", line 1231,
in write
    self.shell.write(s, self.tags)
  File "/home/gpolo/python-dev/py3k/Lib/idlelib/PyShell.py", line 1214,
in write
    self.text.mark_gravity("iomark", "left")
AttributeError: 'NoneType' object has no attribute 'mark_gravity'


I'm not sure if it can't happen in python-trunk too, I see it throws an
exception when leaving IDLE but till now I never got an error message
after IDLE (almost) exited.
msg149708 - (view) Author: Boris FELD (Boris.FELD) * Date: 2011-12-17 21:53
The problem still exists in trunk with 3.2 and 3.3.
msg149790 - (view) Author: Roger Serwy (serwy) * Date: 2011-12-18 18:24
You can trigger this error every time if you change ".after(2*self.poll_interval, self.close2)" to ".after(1, self.close2)" in PyShell.py
msg150106 - (view) Author: Roger Serwy (serwy) * Date: 2011-12-22 19:19
The attached patch fixes the problem. The close method does not need to wait for poll_subprocess rescheduling to stop. The subprocess will be killed, which would cause the socket to timeout. With closing=True, poll_subprocess will return and not reschedule.
History
Date User Action Args
2011-12-22 19:19:26serwysetfiles: + issue5492.patch
keywords: + patch
messages: + msg150106
2011-12-18 18:24:26serwysetnosy: + serwy
messages: + msg149790
2011-12-17 21:53:01Boris.FELDsetnosy: + Boris.FELD

messages: + msg149708
versions: + Python 3.2, Python 3.3
2010-02-10 18:09:17sridsetnosy: + srid
2009-06-14 20:22:11gpolosetmessages: + msg89368
2009-04-26 22:21:15ajaksu2setpriority: normal

nosy: + ajaksu2, gpolo
messages: + msg86624

type: crash -> behavior
stage: test needed
2009-03-15 12:44:36gerluijtencreate