Author terry.reedy
Recipients gpolo, serhiy.storchaka, terry.reedy
Date 2016-06-19.20:26:36
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1466367996.95.0.516468204447.issue22214@psf.upfronthosting.co.za>
In-reply-to
Content
There is no review button for the new patch (don't know why), so: in the News and What's New entries, change "if call" to "if one calls" and "or set" to "or sets".

More importantly, question your use of 'callback' in the entries.  To me, a callback is a function that is passed to a recipient to be called *by the recipient* at some later time. For tkinter, there are command callbacks, which get no arguments, validatecommand callbacks, which get string arguments, event callbacks, which get a tkinter event object as argument, and after callbacks, which get as arguments the Python objects given to the after call.  In all cases, there is no visible issue of passing non-strings as strings to the callback.  The following duplicates the testfunc and interp.call in test_tcl.py as closely as I know how, but with a different result.

import tkinter as tk
root = tk.Tk()
def test(*args):
    for arg in args:
        print(type(arg), '', repr(arg))
root.after(1, test, True, 1, '1')
root.mainloop()

To me, the revised test does not involve a callback.  The test registers a name for the python function so it can be passes by name to Tk().call, as required by the .call signature.  So I would replace 'callback' with 'Python function registered with tk'.

Registered functions can, of course, be used as callback if they have the proper signature.  ConfigDialog registers an 'is_int' function so it can be passed to an Entry as a validatecommand callback.  The patch does not affect registered validate commands because they receive string args.

After grepping idlelib for "register(", I believe this is the only function IDLE registers with tk (two of its classes have non-tk .register methods).  Hence, IDLE should not be affected by the patch and seems not as far as I tested.

I can't properly review the _tkinter patch as it requires too much knowledge of tcl/tk interfaces.
History
Date User Action Args
2016-06-19 20:26:37terry.reedysetrecipients: + terry.reedy, gpolo, serhiy.storchaka
2016-06-19 20:26:36terry.reedysetmessageid: <1466367996.95.0.516468204447.issue22214@psf.upfronthosting.co.za>
2016-06-19 20:26:36terry.reedylinkissue22214 messages
2016-06-19 20:26:36terry.reedycreate