msg312231 - (view) |
Author: Cheryl Sabella (cheryl.sabella) *  |
Date: 2018-02-16 13:20 |
This was discovered while working on . An old comment added for resulted in further research and it was determined that the comment: ! data = self.tk.call('after', 'info', id) ! # In Tk 8.3, splitlist returns: (script, type) ! # In Tk 8.4, splitlist returns: (script,) wasn't correct. The underlying difference is that the call to 'after info' returns different results depending on the way it's called. If it's called with an 'id', it will return a tuple of (script, type) if the id is valid or a TclError if the id isn't valid. However, if id is None, then 'after info' returns a tuple of all the event ids for the widget. In the case of the original bug in , the reported message shows the return value of `('after#53',)`, which is definitely an after event id and not a (script,) tuple. Serhiy mentions on that the current code also deletes the script for the first event if after_cancel is called with None. https://bugs.python.org/issue32839#msg312199 |
|
|
msg312233 - (view) |
Author: Cheryl Sabella (cheryl.sabella) *  |
Date: 2018-02-16 13:45 |
I can open a PR for this, but thought it might be best to discuss it first as far as what should happen with None. 1. Raise an error that it's an incorrect call. 2. Ignore it and just return. 3. Loop through all the events and after_cancel each one. Tcl allows the after_cancel call to be an id or script(s), but they don't have functionality that would cancel everything (unless all the `script` values were sent). FWIW, if no parameters are sent, this is the Tcl code: if (objc < 3) { Tcl_WrongNumArgs(interp, 2, objv, "id|command"); return TCL_ERROR; } |
|
|
msg312234 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2018-02-16 14:39 |
I prefer the option 1. Even if calling after_cancel(None) would make sense, currently it silently does wrong things, and it is more errorproof to make it raising an exception. |
|
|
msg312349 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2018-02-19 12:46 |
I have noticed that there are no tests for after() and after_cancel(). Maybe first write tests for them and later add a test for this specific issue to them? |
|
|
msg312384 - (view) |
Author: Cheryl Sabella (cheryl.sabella) *  |
Date: 2018-02-19 23:50 |
I had also noticed that the `after` commands didn't have tests. Did you want me to add tests in a separate issue before this one is merged or did you want me to add tests under this PR? Thanks! |
|
|
msg312404 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2018-02-20 08:57 |
It's up to you. |
|
|
msg312566 - (view) |
Author: Cheryl Sabella (cheryl.sabella) *  |
Date: 2018-02-22 14:13 |
I've added the tests for `after` and `after_idle`. I used `update` and `update_idletasks` to make sure they processed. Even scheduling an after event for 0 ms didn't guarantee it would process, but I wasn't sure if there was a better way besides `update` to get it to process? |
|
|
msg313207 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2018-03-04 10:41 |
New changeset 74382a3f175ac285cc924a73fd758e8dc3cc41bb by Serhiy Storchaka (Cheryl Sabella) in branch 'master': bpo-32857: Raise error when tkinter after_cancel() is called with None. (GH-5701) https://github.com/python/cpython/commit/74382a3f175ac285cc924a73fd758e8dc3cc41bb |
|
|
msg313209 - (view) |
Author: miss-islington (miss-islington) |
Date: 2018-03-04 11:42 |
New changeset 73a43960c7be50e136c5482404980175cb99f611 by Miss Islington (bot) in branch '3.6': bpo-32857: Raise error when tkinter after_cancel() is called with None. (GH-5701) https://github.com/python/cpython/commit/73a43960c7be50e136c5482404980175cb99f611 |
|
|
msg313210 - (view) |
Author: miss-islington (miss-islington) |
Date: 2018-03-04 12:00 |
New changeset a5303dd9c263b337f02dda0038f2f5a10208140c by Miss Islington (bot) in branch '3.7': bpo-32857: Raise error when tkinter after_cancel() is called with None. (GH-5701) https://github.com/python/cpython/commit/a5303dd9c263b337f02dda0038f2f5a10208140c |
|
|
msg316208 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2018-05-05 13:10 |
New changeset 3a04598f63960e72025a91c682aec51b6b460413 by Serhiy Storchaka (Cheryl Sabella) in branch '2.7': bpo-32857: Raise error when tkinter after_cancel() is called with None. (GH-5701) (GH-6620) https://github.com/python/cpython/commit/3a04598f63960e72025a91c682aec51b6b460413 |
|
|