New submission from Terry J. Reedy: The signature for tkinter class Variable and its subclasses StringVar, IntVar, DoubleVar, BooleanVar is def __init__(self, master=None, value=None, name=None): However, the None default is invalid because of self._tk = master.tk The preceding lines if not master: master = _default_root might suggest that None is acceptible. But _default_root is set to None at the top of the file, so that just replaces None with None.
If Variables must have a gui widget parent, then they cannot be used in gui-free tests, even though they have no graphic representation. Moveover, not everything is a proper master. configSectionNameDialog.py . GetCfgSectionNameDialog(Toplevel) . Create.Widgets(self) has these lines: self.name = StringVar(self) self.fontSize = StringVar(self) However, these are not (always) garbage collectable. After fixing the dialog test at the bottom of the file, and running it with 3.3 python_d -m idlelib.configSectionNameDialog (#18130), and adding the gc flag, I repeatedly got [sys:1: ResourceWarning: gc: 2 uncollectable objects at shutdown [<tkinter.StringVar object at 0x02C597E0>, <tkinter.StringVar ...]] (This only showed when running from the console, not when running within Idle started within the interactive debug interpreter.) Running the test multiple times within a session, by repeatedly creating new dialogs with the [dialog] button in the test window, multiplied the uncollected objects. Replacing 'self' with 'self.parent' solved the problem, at least in the test situation. ---------- components: Tkinter messages: 190574 nosy: gpolo, terry.reedy priority: normal severity: normal stage: needs patch status: open title: Tkinter Variables require a proper master type: behavior versions: Python 2.7, Python 3.3, Python 3.4 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue18131> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com