diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2015-08-17 12:12:16 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-08-17 14:40:55 +0100 |
commit | 7859f7388f2e3f675d0e1527cfde18625f36f637 (patch) | |
tree | dfc71fa8f3c8d66371d03336731b3015f45caaad /lib/bb/event.py | |
parent | 8e9bd559c8ef0ebc9e8babbada06e710908bae08 (diff) | |
download | bitbake-contrib-7859f7388f2e3f675d0e1527cfde18625f36f637.tar.gz |
Fix default function parameter assignment to a list
With python you should not assign a list as the default value of a
function parameter - because a list is mutable, the result will be that
the first time a value is passed it will actually modify the default.
Reference:
http://docs.python-guide.org/en/latest/writing/gotchas/#mutable-default-arguments
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/event.py')
-rw-r--r-- | lib/bb/event.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/bb/event.py b/lib/bb/event.py index 61a7f4a26..0e181102c 100644 --- a/lib/bb/event.py +++ b/lib/bb/event.py @@ -176,7 +176,7 @@ def fire_from_worker(event, d): fire_ui_handlers(event, d) noop = lambda _: None -def register(name, handler, mask=[]): +def register(name, handler, mask=None): """Register an Event handler""" # already registered @@ -389,7 +389,7 @@ class DiskFull(Event): class NoProvider(Event): """No Provider for an Event""" - def __init__(self, item, runtime=False, dependees=None, reasons=[], close_matches=[]): + def __init__(self, item, runtime=False, dependees=None, reasons=None, close_matches=None): Event.__init__(self) self._item = item self._runtime = runtime |