Index: build/android/pylib/utils/timeout_retry.py |
diff --git a/build/android/pylib/utils/timeout_retry.py b/build/android/pylib/utils/timeout_retry.py |
index cdd8b9a593bf5943f748b259b44b4dd3ba267806..e3f179836e7cb234293b3840898edea745c0be71 100644 |
--- a/build/android/pylib/utils/timeout_retry.py |
+++ b/build/android/pylib/utils/timeout_retry.py |
@@ -4,14 +4,13 @@ |
"""A utility to run functions with timeouts and retries.""" |
-import functools |
import threading |
-import reraiser_thread |
-import watchdog_timer |
+from . import reraiser_thread |
+from . import watchdog_timer |
-def Run(func, timeout, retries, args=[], kwargs={}): |
+def Run(func, timeout, retries, args=None, kwargs=None): |
"""Runs the passed function in a separate thread with timeouts and retries. |
Args: |
@@ -24,6 +23,11 @@ def Run(func, timeout, retries, args=[], kwargs={}): |
Returns: |
The return value of func(*args, **kwargs). |
""" |
+ if not args: |
+ args = [] |
+ if not kwargs: |
+ kwargs = {} |
+ |
# The return value uses a list because Python variables are references, not |
# values. Closures make a copy of the reference, so updating the closure's |
# reference wouldn't update where the original reference pointed. |