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/taskdata.py | |
parent | 8e9bd559c8ef0ebc9e8babbada06e710908bae08 (diff) | |
download | bitbake-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/taskdata.py')
-rw-r--r-- | lib/bb/taskdata.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/bb/taskdata.py b/lib/bb/taskdata.py index ca58e1792..5fab7043c 100644 --- a/lib/bb/taskdata.py +++ b/lib/bb/taskdata.py @@ -514,7 +514,7 @@ class TaskData: self.add_runtime_target(fn, item) self.add_tasks(fn, dataCache) - def fail_fnid(self, fnid, missing_list = []): + def fail_fnid(self, fnid, missing_list=None): """ Mark a file as failed (unbuildable) Remove any references from build and runtime provider lists @@ -523,6 +523,8 @@ class TaskData: """ if fnid in self.failed_fnids: return + if not missing_list: + missing_list = [] logger.debug(1, "File '%s' is unbuildable, removing...", self.fn_index[fnid]) self.failed_fnids.append(fnid) for target in self.build_targets: @@ -536,7 +538,7 @@ class TaskData: if len(self.run_targets[target]) == 0: self.remove_runtarget(target, missing_list) - def remove_buildtarget(self, targetid, missing_list = []): + def remove_buildtarget(self, targetid, missing_list=None): """ Mark a build target as failed (unbuildable) Trigger removal of any files that have this as a dependency @@ -561,7 +563,7 @@ class TaskData: logger.error("Required build target '%s' has no buildable providers.\nMissing or unbuildable dependency chain was: %s", target, missing_list) raise bb.providers.NoProvider(target) - def remove_runtarget(self, targetid, missing_list = []): + def remove_runtarget(self, targetid, missing_list=None): """ Mark a run target as failed (unbuildable) Trigger removal of any files that have this as a dependency |