[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 09/15] qmp.py: Avoid overriding a builtin object
From: |
Eduardo Habkost |
Subject: |
[Qemu-devel] [PULL 09/15] qmp.py: Avoid overriding a builtin object |
Date: |
Fri, 15 Sep 2017 20:37:33 -0300 |
From: Lukáš Doktor <address@hidden>
The "id" is a builtin method to get object's identity and should not be
overridden. This might bring some issues in case someone was directly
calling "cmd(..., id=id)" but I haven't found such usage on brief search
for "cmd\(.*id=".
Signed-off-by: Lukáš Doktor <address@hidden>
Reviewed-by: Eduardo Habkost <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Eduardo Habkost <address@hidden>
---
scripts/qmp/qmp.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/scripts/qmp/qmp.py b/scripts/qmp/qmp.py
index f2f5a9b296..ef12e8a1a0 100644
--- a/scripts/qmp/qmp.py
+++ b/scripts/qmp/qmp.py
@@ -177,19 +177,19 @@ class QEMUMonitorProtocol(object):
print >>sys.stderr, "QMP:<<< %s" % resp
return resp
- def cmd(self, name, args=None, id=None):
+ def cmd(self, name, args=None, cmd_id=None):
"""
Build a QMP command and send it to the QMP Monitor.
@param name: command name (string)
@param args: command arguments (dict)
- @param id: command id (dict, list, string or int)
+ @param cmd_id: command id (dict, list, string or int)
"""
qmp_cmd = {'execute': name}
if args:
qmp_cmd['arguments'] = args
- if id:
- qmp_cmd['id'] = id
+ if cmd_id:
+ qmp_cmd['id'] = cmd_id
return self.cmd_obj(qmp_cmd)
def command(self, cmd, **kwds):
--
2.13.5
- [Qemu-devel] [PULL 00/15] Python queue, 2017-09-15, Eduardo Habkost, 2017/09/15
- [Qemu-devel] [PULL 01/15] qemu.py: Pylint/style fixes, Eduardo Habkost, 2017/09/15
- [Qemu-devel] [PULL 02/15] qemu|qtest: Avoid dangerous arguments, Eduardo Habkost, 2017/09/15
- [Qemu-devel] [PULL 03/15] qemu.py: Use iteritems rather than keys(), Eduardo Habkost, 2017/09/15
- [Qemu-devel] [PULL 04/15] qemu.py: Simplify QMP key-conversion, Eduardo Habkost, 2017/09/15
- [Qemu-devel] [PULL 05/15] qemu.py: Use custom exceptions rather than Exception, Eduardo Habkost, 2017/09/15
- [Qemu-devel] [PULL 07/15] qmp.py: Use object-based class for QEMUMonitorProtocol, Eduardo Habkost, 2017/09/15
- [Qemu-devel] [PULL 06/15] qmp.py: Couple of pylint/style fixes, Eduardo Habkost, 2017/09/15
- [Qemu-devel] [PULL 08/15] qmp.py: Avoid "has_key" usage, Eduardo Habkost, 2017/09/15
- [Qemu-devel] [PULL 09/15] qmp.py: Avoid overriding a builtin object,
Eduardo Habkost <=
- [Qemu-devel] [PULL 10/15] qtest.py: Few pylint/style fixes, Eduardo Habkost, 2017/09/15
- [Qemu-devel] [PULL 11/15] qemu.py: fix is_running() return before first launch(), Eduardo Habkost, 2017/09/15
- [Qemu-devel] [PULL 12/15] qemu.py: avoid writing to stdout/stderr, Eduardo Habkost, 2017/09/15
- [Qemu-devel] [PULL 13/15] qemu.py: use os.path.null instead of /dev/null, Eduardo Habkost, 2017/09/15
- [Qemu-devel] [PULL 14/15] qemu.py: improve message on negative exit code, Eduardo Habkost, 2017/09/15
- [Qemu-devel] [PULL 15/15] qemu.py: include debug information on launch error, Eduardo Habkost, 2017/09/15
- Re: [Qemu-devel] [PULL 00/15] Python queue, 2017-09-15, Peter Maydell, 2017/09/16