[Qemu-devel] [PATCH 11/11] qtest.py: Avoid using mutable list as default argument

Lukáš Doktor posted 11 patches 8 years, 6 months ago
There is a newer version of this series
[Qemu-devel] [PATCH 11/11] qtest.py: Avoid using mutable list as default argument
Posted by Lukáš Doktor 8 years, 6 months ago
The list is a mutable object and is dangerous to use it. Recently the
QEMUMachine was adjusted to allow None as default, let's use it here as
well.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
---
 scripts/qtest.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/qtest.py b/scripts/qtest.py
index e4b5788..ba3233c 100644
--- a/scripts/qtest.py
+++ b/scripts/qtest.py
@@ -76,7 +76,7 @@ class QEMUQtestProtocol(object):
 class QEMUQtestMachine(qemu.QEMUMachine):
     '''A QEMU VM'''
 
-    def __init__(self, binary, args=[], name=None, test_dir="/var/tmp",
+    def __init__(self, binary, args=None, name=None, test_dir="/var/tmp",
                  socket_scm_helper=None):
         if name is None:
             name = "qemu-%d" % os.getpid()
-- 
2.9.4


Re: [Qemu-devel] [PATCH 11/11] qtest.py: Avoid using mutable list as default argument
Posted by Eduardo Habkost 8 years, 6 months ago
On Thu, Jul 20, 2017 at 06:28:15PM +0200, Lukáš Doktor wrote:
> The list is a mutable object and is dangerous to use it. Recently the
> QEMUMachine was adjusted to allow None as default, let's use it here as
> well.
> 
> Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>

This patch requires patch 02/11 and both are pretty small.
I suggest squashing them together.

-- 
Eduardo

Re: [Qemu-devel] [PATCH 11/11] qtest.py: Avoid using mutable list as default argument
Posted by Lukáš Doktor 8 years, 6 months ago
Dne 20.7.2017 v 20:44 Eduardo Habkost napsal(a):
> On Thu, Jul 20, 2017 at 06:28:15PM +0200, Lukáš Doktor wrote:
>> The list is a mutable object and is dangerous to use it. Recently the
>> QEMUMachine was adjusted to allow None as default, let's use it here as
>> well.
>>
>> Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
> 
> This patch requires patch 02/11 and both are pretty small.
> I suggest squashing them together.
> 

Sure, I'll change it in the v2.

Lukáš