On 07/25/2017 11:09 AM, Lukáš Doktor wrote:
The list object is mutable in python and potentially might modify other
object's arguments when used as default argument. Reproducer:
>>> vm1 = QEMUMachine("qemu")
>>> vm2 = QEMUMachine("qemu")
>>> vm1._wrapper.append("foo")
>>> print vm2._wrapper
['foo']
In this case the `args` is actually copied so it would be safe to keep
it, but it's not a good practice to keep it. The same issue applies in
inherited qtest module.
ohh, grr, this trips me up in Python all the time. Definitely best to
remove such usages where possible.
Signed-off-by: Lukáš Doktor <[email protected]>
Reviewed-by: Eduardo Habkost <[email protected]>
Reviewed-by: John Snow <[email protected]>