diff options
author | R David Murray <rdmurray@bitdance.com> | 2013-03-30 21:22:30 (GMT) |
---|---|---|
committer | R David Murray <rdmurray@bitdance.com> | 2013-03-30 21:22:30 (GMT) |
commit | 5cbf3a0d6e6f35374a32a933dcca7ce3683595c6 (patch) | |
tree | 63d8d54a05d9668e1b5373bb9215af48d5787b64 /Lib/threading.py | |
parent | ce852cb8b9d5f879941fe709118f0e966e65196f (diff) | |
parent | 19aeb439c6ca0da540ad95eec599d3654babe20b (diff) | |
download | cpython-5cbf3a0d6e6f35374a32a933dcca7ce3683595c6.zip cpython-5cbf3a0d6e6f35374a32a933dcca7ce3683595c6.tar.gz cpython-5cbf3a0d6e6f35374a32a933dcca7ce3683595c6.tar.bz2 |
Merge #17435: Don't use mutable default values in Timer.
Patch by Denver Coneybeare with some test modifications by me.
Diffstat (limited to 'Lib/threading.py')
-rw-r--r-- | Lib/threading.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/threading.py b/Lib/threading.py index 80dd51f..e7f7df7 100644 --- a/Lib/threading.py +++ b/Lib/threading.py @@ -807,17 +807,17 @@ class Thread: 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): |