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/msg.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/msg.py')
-rw-r--r-- | lib/bb/msg.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/bb/msg.py b/lib/bb/msg.py index d79768db2..786b5aef4 100644 --- a/lib/bb/msg.py +++ b/lib/bb/msg.py @@ -150,7 +150,7 @@ loggerDefaultVerbose = False loggerVerboseLogs = False loggerDefaultDomains = [] -def init_msgconfig(verbose, debug, debug_domains = []): +def init_msgconfig(verbose, debug, debug_domains=None): """ Set default verbosity and debug levels config the logger """ @@ -158,7 +158,10 @@ def init_msgconfig(verbose, debug, debug_domains = []): bb.msg.loggerDefaultVerbose = verbose if verbose: bb.msg.loggerVerboseLogs = True - bb.msg.loggerDefaultDomains = debug_domains + if debug_domains: + bb.msg.loggerDefaultDomains = debug_domains + else: + bb.msg.loggerDefaultDomains = [] def constructLogOptions(): debug = loggerDefaultDebugLevel |