diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2018-03-04 03:42:41 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-04 03:42:41 -0800 |
commit | 73a43960c7be50e136c5482404980175cb99f611 (patch) | |
tree | e0ae31dce06413074715bb4abb1c9575ffb40b5d /Lib/tkinter/__init__.py | |
parent | c9516754067d71fd7429a25ccfcb2141fc583523 (diff) | |
download | cpython-git-73a43960c7be50e136c5482404980175cb99f611.tar.gz |
bpo-32857: Raise error when tkinter after_cancel() is called with None. (GH-5701)
(cherry picked from commit 74382a3f175ac285cc924a73fd758e8dc3cc41bb)
Co-authored-by: Cheryl Sabella <cheryl.sabella@gmail.com>
Diffstat (limited to 'Lib/tkinter/__init__.py')
-rw-r--r-- | Lib/tkinter/__init__.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Lib/tkinter/__init__.py b/Lib/tkinter/__init__.py index deea791831..53bad3fa95 100644 --- a/Lib/tkinter/__init__.py +++ b/Lib/tkinter/__init__.py @@ -739,6 +739,7 @@ class Misc: if not func: # I'd rather use time.sleep(ms*0.001) self.tk.call('after', ms) + return None else: def callit(): try: @@ -762,11 +763,13 @@ class Misc: """Cancel scheduling of function identified with ID. Identifier returned by after or after_idle must be - given as first parameter.""" + given as first parameter. + """ + if not id: + raise ValueError('id must be a valid identifier returned from ' + 'after or after_idle') try: data = self.tk.call('after', 'info', id) - # In Tk 8.3, splitlist returns: (script, type) - # In Tk 8.4, splitlist may return (script, type) or (script,) script = self.tk.splitlist(data)[0] self.deletecommand(script) except TclError: |