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-19 18:05:44 +0100 |
commit | 715d857174ceca82b85d6c8c7df520047ba7fb0c (patch) | |
tree | 363aac81a06b013471f1dede8ba4c0dc7d8bbe92 /bitbake/lib/bb/event.py | |
parent | 22a653d02880c35d3c9d04811c31aabdf1e69951 (diff) | |
download | poky-715d857174ceca82b85d6c8c7df520047ba7fb0c.tar.gz |
bitbake: 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
(Bitbake rev: 7859f7388f2e3f675d0e1527cfde18625f36f637)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/event.py')
-rw-r--r-- | bitbake/lib/bb/event.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py index 61a7f4a265..0e181102c6 100644 --- a/bitbake/lib/bb/event.py +++ b/bitbake/lib/bb/event.py | |||
@@ -176,7 +176,7 @@ def fire_from_worker(event, d): | |||
176 | fire_ui_handlers(event, d) | 176 | fire_ui_handlers(event, d) |
177 | 177 | ||
178 | noop = lambda _: None | 178 | noop = lambda _: None |
179 | def register(name, handler, mask=[]): | 179 | def register(name, handler, mask=None): |
180 | """Register an Event handler""" | 180 | """Register an Event handler""" |
181 | 181 | ||
182 | # already registered | 182 | # already registered |
@@ -389,7 +389,7 @@ class DiskFull(Event): | |||
389 | class NoProvider(Event): | 389 | class NoProvider(Event): |
390 | """No Provider for an Event""" | 390 | """No Provider for an Event""" |
391 | 391 | ||
392 | def __init__(self, item, runtime=False, dependees=None, reasons=[], close_matches=[]): | 392 | def __init__(self, item, runtime=False, dependees=None, reasons=None, close_matches=None): |
393 | Event.__init__(self) | 393 | Event.__init__(self) |
394 | self._item = item | 394 | self._item = item |
395 | self._runtime = runtime | 395 | self._runtime = runtime |