From 7859f7388f2e3f675d0e1527cfde18625f36f637 Mon Sep 17 00:00:00 2001 From: Paul Eggleton Date: Mon, 17 Aug 2015 12:12:16 +0100 Subject: 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 Signed-off-by: Richard Purdie --- lib/bb/server/process.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/bb/server/process.py') diff --git a/lib/bb/server/process.py b/lib/bb/server/process.py index ef3ee57aa..3198635e2 100644 --- a/lib/bb/server/process.py +++ b/lib/bb/server/process.py @@ -124,8 +124,10 @@ class ProcessServer(Process, BaseImplServer): self.command_channel.close() self.cooker.shutdown(True) - def idle_commands(self, delay, fds = []): + def idle_commands(self, delay, fds=None): nextsleep = delay + if not fds: + fds = [] for function, data in self._idlefuns.items(): try: -- cgit 1.2.3-korg