serhiy-storchaka · GitHub

Misc.wait_variable(), Misc.setvar() and Misc.getvar() have default values for parameters that should be required: name='PY_VAR' (all three) and value='1' (setvar).

'PY_VAR' is not a meaningful variable name -- tkinter auto-generates names as PY_VAR0, PY_VAR1, etc., never the bare 'PY_VAR' -- so calling these methods without a name operates on a variable that almost never exists. Likewise, defaulting setvar's value to '1' is arbitrary.

These defaults were only recently documented (gh-86726) and should not be advertised. As a first step, undocument them (backported).

Then make the parameters required by dropping the defaults from wait_variable(name), getvar(name) and setvar(name, value) (the waitvar alias follows). This is a behavior change for 3.16 only; calls relying on the defaults will raise TypeError instead of silently operating on a useless variable. If this proves disruptive during the development period, it can be reverted.

Linked PRs

Read the original on github.com ↗