Issue #10365: File open dialog now works instead of crashing
even when parent window is closed. Patch by Roger Serwy.
diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py
index 74a37db..edb4f37 100644
--- a/Lib/idlelib/PyShell.py
+++ b/Lib/idlelib/PyShell.py
@@ -1435,7 +1435,8 @@
     if tkversionwarning:
         shell.interp.runcommand(''.join(("print('", tkversionwarning, "')")))
 
-    root.mainloop()
+    while flist.inversedict:  # keep IDLE running while files are open.
+        root.mainloop()
     root.destroy()
 
 if __name__ == "__main__":