Message190574
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. |
|
Date |
User |
Action |
Args |
2013-06-04 01:13:00 | terry.reedy | set | recipients:
+ terry.reedy, gpolo |
2013-06-04 01:12:59 | terry.reedy | set | messageid: <1370308379.98.0.744218229266.issue18131@psf.upfronthosting.co.za> |
2013-06-04 01:12:59 | terry.reedy | link | issue18131 messages |
2013-06-04 01:12:59 | terry.reedy | create | |
|