diff options
| author | Lukáš Doktor | 2017-08-18 16:26:05 +0200 |
|---|---|---|
| committer | Eduardo Habkost | 2017-09-16 01:12:00 +0200 |
| commit | 2782fc517d6720dbec24b4dfa08aa4606c72c76d (patch) | |
| tree | 5044cb0bf5a054d8abe887cff1d20bf5390d453e /include/exec | |
| parent | qemu.py: Pylint/style fixes (diff) | |
| download | qemu-2782fc517d6720dbec24b4dfa08aa4606c72c76d.tar.gz qemu-2782fc517d6720dbec24b4dfa08aa4606c72c76d.tar.xz qemu-2782fc517d6720dbec24b4dfa08aa4606c72c76d.zip | |
qemu|qtest: Avoid dangerous arguments
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.
Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Message-Id: <20170818142613.32394-3-ldoktor@redhat.com>
Reviewed-by: Cleber Rosa <crosa@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'include/exec')
0 files changed, 0 insertions, 0 deletions
