Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(159513)

Unified Diff: Lib/threading.py

Issue 17435: threading.Timer.__init__() should use immutable argument defaults for args and kwargs
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Lib/test/test_threading.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Lib/threading.py Wed Mar 13 02:27:53 2013 +0200
+++ b/Lib/threading.py Fri Mar 15 19:58:29 2013 -0400
@@ -808,17 +808,17 @@
class Timer(Thread):
"""Call a function after a specified number of seconds:
- t = Timer(30.0, f, args=[], kwargs={})
+ t = Timer(30.0, f, args=None, kwargs=None)
t.start()
t.cancel() # stop the timer's action if it's still waiting
"""
- def __init__(self, interval, function, args=[], kwargs={}):
+ def __init__(self, interval, function, args=None, kwargs=None):
Thread.__init__(self)
self.interval = interval
self.function = function
- self.args = args
- self.kwargs = kwargs
+ self.args = args if args is not None else []
+ self.kwargs = kwargs if kwargs is not None else {}
self.finished = Event()
def cancel(self):
« no previous file with comments | « Lib/test/test_threading.py ('k') | no next file » | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+