Index: build/android/pylib/utils/reraiser_thread.py |
diff --git a/build/android/pylib/utils/reraiser_thread.py b/build/android/pylib/utils/reraiser_thread.py |
index d4ba781a32d856def495f44499ce123cd94d9fc0..eed72c173ead636d8397a174ef3a92757f43e596 100644 |
--- a/build/android/pylib/utils/reraiser_thread.py |
+++ b/build/android/pylib/utils/reraiser_thread.py |
@@ -3,14 +3,14 @@ |
# found in the LICENSE file. |
"""Thread and ThreadGroup that reraise exceptions on the main thread.""" |
+# pylint: disable=W0212 |
import logging |
import sys |
import threading |
-import time |
import traceback |
-import watchdog_timer |
+from pylib.utils import watchdog_timer |
class TimeoutError(Exception): |
@@ -38,7 +38,7 @@ def LogThreadStack(thread): |
class ReraiserThread(threading.Thread): |
"""Thread class that can reraise exceptions.""" |
- def __init__(self, func, args=[], kwargs={}, name=None): |
+ def __init__(self, func, args=None, kwargs=None, name=None): |
"""Initialize thread. |
Args: |
@@ -48,6 +48,10 @@ class ReraiserThread(threading.Thread): |
name: thread name, defaults to Thread-N. |
""" |
super(ReraiserThread, self).__init__(name=name) |
+ if not args: |
+ args = [] |
+ if not kwargs: |
+ kwargs = {} |
self.daemon = True |
self._func = func |
self._args = args |
@@ -72,12 +76,14 @@ class ReraiserThread(threading.Thread): |
class ReraiserThreadGroup(object): |
"""A group of ReraiserThread objects.""" |
- def __init__(self, threads=[]): |
+ def __init__(self, threads=None): |
"""Initialize thread group. |
Args: |
threads: a list of ReraiserThread objects; defaults to empty. |
""" |
+ if not threads: |
+ threads = [] |
self._threads = threads |
def Add(self, thread): |