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/msg.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/msg.py')
-rw-r--r-- | bitbake/lib/bb/msg.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/bitbake/lib/bb/msg.py b/bitbake/lib/bb/msg.py index d79768db24..786b5aef40 100644 --- a/bitbake/lib/bb/msg.py +++ b/bitbake/lib/bb/msg.py | |||
@@ -150,7 +150,7 @@ loggerDefaultVerbose = False | |||
150 | loggerVerboseLogs = False | 150 | loggerVerboseLogs = False |
151 | loggerDefaultDomains = [] | 151 | loggerDefaultDomains = [] |
152 | 152 | ||
153 | def init_msgconfig(verbose, debug, debug_domains = []): | 153 | def init_msgconfig(verbose, debug, debug_domains=None): |
154 | """ | 154 | """ |
155 | Set default verbosity and debug levels config the logger | 155 | Set default verbosity and debug levels config the logger |
156 | """ | 156 | """ |
@@ -158,7 +158,10 @@ def init_msgconfig(verbose, debug, debug_domains = []): | |||
158 | bb.msg.loggerDefaultVerbose = verbose | 158 | bb.msg.loggerDefaultVerbose = verbose |
159 | if verbose: | 159 | if verbose: |
160 | bb.msg.loggerVerboseLogs = True | 160 | bb.msg.loggerVerboseLogs = True |
161 | bb.msg.loggerDefaultDomains = debug_domains | 161 | if debug_domains: |
162 | bb.msg.loggerDefaultDomains = debug_domains | ||
163 | else: | ||
164 | bb.msg.loggerDefaultDomains = [] | ||
162 | 165 | ||
163 | def constructLogOptions(): | 166 | def constructLogOptions(): |
164 | debug = loggerDefaultDebugLevel | 167 | debug = loggerDefaultDebugLevel |