Title: Save on Close fails in IDLE, from Linux system
Type: behavior Stage: resolved
Components: IDLE, Library (Lib), Tkinter Versions: Python 3.1, Python 3.2, Python 3.3, Python 2.7
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: kbk Nosy List: kbk, marcus777, ned.deily, python-dev, terry.reedy
Priority: normal Keywords:

Created on 2011-04-21 06:06 by marcus777, last changed 2011-05-13 01:19 by python-dev. This issue is now closed.

Messages (6)
msg134194 - (view) Author: marcus harris (marcus777) Date: 2011-04-21 06:06
Under some circumstances, which I will detail later down the note, if I click File --> Close without explicitly saving, and without running the module with Run --> Run Module , then the last changes I made to the file do not get saved. The save dialogue pop-up does appear, and I do select YES--- I want to save before closing--- but when I re-open the file (IDLE or vi) the changes are not there... as though the save binding did not work, or like there was some timing glitch that prevented the save somehow before the edit window closed down. The error is not solid, in that, if the file is larger (significantly) then the File --> Close (select Yes on the dialogue) does work... ??

The work around is to do either 1) run the module, or 2) explicitly click File --> Save.

The alleged bug can be reproduced on both of my primary desk machines, Linux systems, using IDLE on 2.6, 2.7, and 3.2/  These are the instructions for reproducing this little snag:

1) Open a new edit window with File --> New Window

2) Enter the following code on the first two lines:
def testfunc():
    return None

3) Click File --> Save    ( )

4) Click File --> Close

5) Open the file with  File --> Recent Files   ( select )

6) Use the edit window to place these three lines above testfunc:
# comment block

7) Click    File --> Close

8) When the Save on Close dialogue appears select "Yes"

9) Re-open the file with   File --> Recent Files   ( select )

10) The comment block will not be there...  didn't save. 

Running on Ubuntu 9.10  (all updates)

Tk  8.5.x

reproduced on built-in 2.6
   & compiled from sources...   2.7  &  3.2

kind regards,
m harris
msg134195 - (view) Author: marcus harris (marcus777) Date: 2011-04-21 06:14
Terry Reedy was not able to reproduce this snag on an XP system; however, suggested there might be a real save on close error on the linux side... also requested to be place on the nosy list...
msg134196 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2011-04-21 07:39
Thanks for the precise test case.  I am able to reproduce the failure on OS X using the MacPorts X11-Tk Tkinter but not with the standard OS X AquaTk Tkinter.
msg135854 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2011-05-12 19:37
New changeset da7a120c0478 by Kurt B. Kaiser in branch '3.1':
Issue #11896: Save on Close failed despite selecting "Yes" in dialog.

New changeset 87196154dec8 by Kurt B. Kaiser in branch 'default':
Merge from 3.2
msg135859 - (view) Author: Kurt B. Kaiser (kbk) * (Python committer) Date: 2011-05-12 20:09
tkinter.messagebox.Message sending <class '_tkinter.Tcl_Obj'> rather
than str, so comparison with str failed.  Always for "cancel", (almost?)
always for "yes".

Use the helper functions in tkinter.messagebox, which correct for that.

This hasn't worked for a long time, I'm surprised it just came up.  Will
backport to 2.7.
msg135886 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2011-05-13 01:19
New changeset ac14158462cf by Kurt B. Kaiser in branch '2.7':
Issue #11896: Save on Close failed despite selecting "Yes" in dialog.
Date User Action Args
2011-05-13 01:19:02python-devsetmessages: + msg135886
2011-05-12 20:09:02kbksetstatus: open -> closed

assignee: ned.deily -> kbk
versions: + Python 3.1, Python 3.3, - Python 2.6
nosy: + kbk

messages: + msg135859
resolution: fixed
stage: needs patch -> resolved
2011-05-12 19:37:03python-devsetnosy: + python-dev
messages: + msg135854
2011-04-21 07:39:36ned.deilysetnosy: + ned.deily
messages: + msg134196

assignee: ned.deily
stage: needs patch
2011-04-21 06:14:34marcus777setmessages: + msg134195
2011-04-21 06:06:05marcus777create