mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
bpo-32857: Raise error when tkinter after_cancel() is called with None. (GH-5701)
This commit is contained in:
parent
7023644e0c
commit
74382a3f17
3 changed files with 115 additions and 3 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue