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..a4f663ba1a148e5c006f7c2c6e76c33792a32341 100644 |
--- a/build/android/pylib/utils/reraiser_thread.py |
+++ b/build/android/pylib/utils/reraiser_thread.py |
@@ -7,10 +7,9 @@ |
import logging |
import sys |
import threading |
-import time |
import traceback |
-import watchdog_timer |
+from . import watchdog_timer |
class TimeoutError(Exception): |
@@ -38,7 +37,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 +47,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 +75,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): |