[issue27024] IDLE shutdown glitch when started by import

2016-06-12 Thread Mark Roseman

Mark Roseman added the comment:

tried this patch on 3.6 as per terry's previous msg; still getting same error 
in idle test suite on os x

--
nosy: +markroseman

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27024] IDLE shutdown glitch when started by import

2016-06-12 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I applied to 2.7 after changing the file name.  I still get
F:\Python\dev\27>pcbuild\python_d.exe -m test.regrtest -ugui test_idle
[1/1] test_idle
can't invoke "event" command:  application has been destroyed
while executing
"event generate $w <>"
(procedure "ttk::ThemeChanged" line 6)
invoked from within
"ttk::ThemeChanged"
can't invoke "event" command:  application has been destroyed
while executing
"event generate $w <>"
(procedure "ttk::ThemeChanged" line 6)
invoked from within
"ttk::ThemeChanged"

This is the only instance left in all three versions after using 
root.update_idletasks where needed.  It does not occur when running the 
particular test file by itself.  Mark Roseman say something similar running 
test.test_idle with 3.6 on Mac.  I do not running same on Windows.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27024] IDLE shutdown glitch when started by import

2016-05-15 Thread Terry J. Reedy

Terry J. Reedy added the comment:

This is a partial fix.  Run python, import idlelib.idle, open idlelib.run, 
close editor, close shell, get clean >>> prompt in python. No 'bgerror ...'.  
This is probably enough to justify patch.  (Directly opening and closing IDLE 
continues to work fine, as before.)

Close shell first, then editor, get >>> + similar 'invalid ... invalid ...' 
message as reported above.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27024] IDLE shutdown glitch when started by import

2016-05-15 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Proposed patch fixes the issue for all Tkinter applications.

--
components: +Tkinter -IDLE
keywords: +patch
stage: test needed -> patch review
type:  -> behavior
versions: +Python 2.7
Added file: 
http://bugs.python.org/file42857/tkinter_destroy_cancel_handlers.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27024] IDLE shutdown glitch when started by import

2016-05-15 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

There are few possible workarounds:

1. Catch and ignore TclError in CodeContext.timer_event, 
CodeContext.font_timer_event and other callbacks.

2. Save results of after() and after_idle() calls and pass them to 
after_cancel() before destroying widgets. Maybe this should be done 
automatically in Tkinter.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27024] IDLE shutdown glitch when started by import

2016-05-14 Thread Terry J. Reedy

New submission from Terry J. Reedy:

Win10, 3.5.1: Run 'python' in interactive mode.
>>> import idlelib.idle  # open idle shell
# or import idlelib.__main__
# only works once in an interactive session as re-import does not rerun
# In IDLE, open editor to some file.  For instance, alt-M, idlelib.run.

# Close editor, close shell.  In python, see something like
>>> bgerror failed to handle background error.
Original error: invalid command name "2361007434952font_timer_event"
Error in bgerror: can't invoke "tk" command: application has been destroyed"

Exit python, restart, import to start idle.
Close shell, close editor.  In python window, see
>>> invalid command name "1220802489864timer_event"
while executing
"1220802489864timer_event"
("after" script)
invalid command name "1220865810504font_timer_event"
while executing
"1220865810504font_timer_event"
("after" script)

Opening IDLE directly with 'python -m idlelib' (or 'idlelib.idle') does not 
show the problem.  So this is not a problem for the vast majority of users who 
run idle in an idle process.

My guess is that shutting down the entire process instead of just the idle part 
of a process shuts down tcl/tk and any pending callbacks.  Perhaps some tkinter 
class is called without passing the explicit IDLE root.  Though I then would 
not understand why the callback fails.

My guess is that the order dependence is associated with the startup and 
shutdown code being part of PyShell instead of being in an independent app 
module.  (I hope to change this.)

Serhiy, do you have any additiional insight into what is going on and what I 
should look for?

--
components: IDLE
messages: 265581
nosy: serhiy.storchaka, terry.reedy
priority: normal
severity: normal
stage: test needed
status: open
title: IDLE shutdown glitch when started by import
versions: Python 3.5, Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com