[issue21682] Refleak in idle_test test_autocomplete

Terry J. Reedy report at bugs.python.org
Sat Jun 7 10:32:26 CEST 2014


Terry J. Reedy added the comment:

This concerns me. I expect that we will eventually want to test a live EditorWindow or subclass. It appears that root.destroy does not clear all the widgets created by EditorWindow(root=root). My guess it that something is created without passing in root, so that tkinter._default_root gets used instead. This needs investigation.

I actually ran into this problem before, though not in full form, as I did not commit test_formatparagraph.py with EditorWindow(). I used a mock containing a method extracted from EditorWindow that does not cause problems, after noting the following.

# A real EditorWindow creates unneeded, time-consuming baggage and
# sometimes emits shutdown warnings like this:
# "warning: callback failed in WindowList <class '_tkinter.TclError'>
# : invalid command name ".55131368.windows".
# Calling EditorWindow._close in tearDownClass prevents this but causes
# other problems (windows left open).

Why did I commit this with EditorWindow used as is? Because I forgot the above, written last August and did not think to see how easy it would be to mock the minimum needed. I need to make sure to put DO NOT USE EditorWindow ... in README.txt.

I did not get the error message in several all ok runs. We can worry later about using mock Text for a non-gui alternative. Thanks Zack for catching this and Saimadhav to fixing it.

----------
resolution:  -> fixed
stage: needs patch -> resolved
status: open -> closed

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


More information about the Python-bugs-list mailing list