[issue10365] IDLE Crashes on File Open Dialog when code window closed before other file opened

Terry J. Reedy report at bugs.python.org
Sun May 27 03:22:48 CEST 2012


Terry J. Reedy <tjreedy at udel.edu> added the comment:

I verified problem in 3.3 and when opening dialog from shell.
Patch fixes problem, including open idle, open dialog, close shell, select file, and now file is opened. Thanks Roger. I went ahead and applied fix. (But note: your patch had a 'blank' line with several spaces. Not allowed. We both should remember to run whitespace-at-end-of-line stripper.)

I did not close yet because I think the comments need improvement (and perhaps made into doc string). Hence 'needs (second) patch'.

      # If the current window has no filename and hasn't been
      # modified, we replace its contents (no loss).  Otherwise
      # we open a new window.  But we won't replace the
      # shell window (which has an interp(reter) attribute), which
      # gets set to "not modified" at every new prompt.

I think that means to say "If the current window is a never-modified new, empty, untitled edit window, load the file there." If it had any contents to replace, I believe it would be either titled or modified. So that seem misleading.

The 'otherwise..open a new window' is not true since a file can be opened (for writing) only once, and if it is already open, focus is simply shifted to its current window.

So I think the behavior can be summarized as "If the file is already open in an edit window, shift focus to that window. Otherwise open a new window (or use the current window if it is new, unmodified, and untitled) and load the file."

      # Also, make sure the current window has not been closed,
      # since it can be closed during the Open File dialog.

This seems misplaced where it is since overall we are *not* making sure that the current window is still open, but are taking measures to make sure open works even if it has been closed. I think that the comment that might be added before this block is that flist is being saved in case the parent window gets closed while the dialog is open.

I am also curious if you understand
 # Code for use outside IDLE:
or might this be obsolete?

----------
stage:  -> needs patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10365>
_______________________________________


More information about the Python-bugs-list mailing list