From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: qemu-devel@nongnu.org
Cc: "John Snow" <jsnow@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@redhat.com>,
"Eduardo Habkost" <ehabkost@redhat.com>,
"Wainer dos Santos Moschetta" <wainersm@redhat.com>,
"Cleber Rosa" <crosa@redhat.com>
Subject: [PULL 01/46] python/qemu: qmp: Replace socket.error with OSError
Date: Thu, 6 Feb 2020 22:18:51 +0100 [thread overview]
Message-ID: <20200206211936.17098-2-philmd@redhat.com> (raw)
In-Reply-To: <20200206211936.17098-1-philmd@redhat.com>
From: Wainer dos Santos Moschetta <wainersm@redhat.com>
The socket.error is deprecated from Python 3.3, instead it is
made a link to OSError. This change replaces the occurences
of socket.error with OSError.
Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Message-Id: <20191227134101.244496-2-wainersm@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
python/qemu/qmp.py | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/python/qemu/qmp.py b/python/qemu/qmp.py
index 5c8cf6a056..8c6c9847d0 100644
--- a/python/qemu/qmp.py
+++ b/python/qemu/qmp.py
@@ -47,7 +47,7 @@ class QEMUMonitorProtocol(object):
or a tuple in the form ( address, port ) for a TCP
connection
@param server: server mode listens on the socket (bool)
- @raise socket.error on socket connection errors
+ @raise OSError on socket connection errors
@note No connection is established, this is done by the connect() or
accept() methods
"""
@@ -107,8 +107,8 @@ class QEMUMonitorProtocol(object):
self.__sock.setblocking(0)
try:
self.__json_read()
- except socket.error as err:
- if err[0] == errno.EAGAIN:
+ except OSError as err:
+ if err.errno == errno.EAGAIN:
# No data available
pass
self.__sock.setblocking(1)
@@ -133,7 +133,7 @@ class QEMUMonitorProtocol(object):
Connect to the QMP Monitor and perform capabilities negotiation.
@return QMP greeting dict
- @raise socket.error on socket connection errors
+ @raise OSError on socket connection errors
@raise QMPConnectError if the greeting is not received
@raise QMPCapabilitiesError if fails to negotiate capabilities
"""
@@ -147,7 +147,7 @@ class QEMUMonitorProtocol(object):
Await connection from QMP Monitor and perform capabilities negotiation.
@return QMP greeting dict
- @raise socket.error on socket connection errors
+ @raise OSError on socket connection errors
@raise QMPConnectError if the greeting is not received
@raise QMPCapabilitiesError if fails to negotiate capabilities
"""
@@ -167,10 +167,10 @@ class QEMUMonitorProtocol(object):
self.logger.debug(">>> %s", qmp_cmd)
try:
self.__sock.sendall(json.dumps(qmp_cmd).encode('utf-8'))
- except socket.error as err:
- if err[0] == errno.EPIPE:
+ except OSError as err:
+ if err.errno == errno.EPIPE:
return
- raise socket.error(err)
+ raise err
resp = self.__json_read()
self.logger.debug("<<< %s", resp)
return resp
--
2.21.1
next prev parent reply other threads:[~2020-02-06 21:21 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-06 21:18 [PULL 00/46] Python queue 2020-02-06 Philippe Mathieu-Daudé
2020-02-06 21:18 ` Philippe Mathieu-Daudé [this message]
2020-02-06 21:18 ` [PULL 02/46] python/qemu: Delint the qmp module Philippe Mathieu-Daudé
2020-02-06 21:18 ` [PULL 03/46] python/qemu: qmp: Make accept()'s timeout configurable Philippe Mathieu-Daudé
2020-02-06 21:18 ` [PULL 04/46] python/qemu: qmp: Make QEMUMonitorProtocol a context manager Philippe Mathieu-Daudé
2020-02-06 21:18 ` [PULL 05/46] python/qemu: qmp: Remove unnused attributes Philippe Mathieu-Daudé
2020-02-06 21:18 ` [PULL 06/46] python/qemu: accel: Fix kvm_available() on ppc64le Philippe Mathieu-Daudé
2020-02-06 21:18 ` [PULL 07/46] qemu-deprecated: Remove text about Python 2 Philippe Mathieu-Daudé
2020-02-06 21:18 ` [PULL 08/46] python: Treat None-return of greeting cmd Philippe Mathieu-Daudé
2020-02-06 21:18 ` [PULL 09/46] python/qemu/machine: Allow to use other serial consoles than default Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 10/46] Acceptance tests: Extract _console_interaction() Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 11/46] Acceptance tests: Add interrupt_interactive_console_until_pattern() Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 12/46] travis.yml: install rpm2cpio for acceptance tests Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 13/46] tests/boot_linux_console: add extract_from_rpm method Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 14/46] tests/boot_linux_console: use os.path for filesystem paths Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 15/46] tests/boot_linux_console: fix extract_from_deb() comment Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 16/46] tests/boot_linux_console: Tag Emcraft Smartfusion2 as running 'u-boot' Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 17/46] tests/acceptance: Add boot tests for some of the QEMU advent calendar images Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 18/46] tests: rename virtio_seg_max_adjust to virtio_check_params Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 19/46] tests/acceptance/virtio_check_params: Improve exception logging Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 20/46] tests/acceptance/virtio_check_params: List machine being tested Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 21/46] tests/acceptance/virtio_check_params: Default to -nodefaults Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 22/46] tests/acceptance/virtio_check_params: Disable the test Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 23/46] tests/acceptance/boot_linux_console: Do not use VGA on Clipper machine Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 24/46] tests/acceptance/version: Default to -nodefaults Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 25/46] tests/acceptance/migration: Factor out assert_migration() Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 26/46] tests/acceptance/migration: Factor out do_migrate() Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 27/46] tests/acceptance/migration: Test UNIX transport when migrating Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 28/46] tests/acceptance/migration: Test EXEC " Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 29/46] tests/acceptance/migration: Add the 'migration' tag Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 30/46] tests/acceptance/migration: Default to -nodefaults Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 31/46] scripts/checkpatch.pl: Only allow Python 3 interpreter Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 32/46] tests/qemu-iotests/check: Allow use of python3 interpreter Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 33/46] tests/qemu-iotests: Explicit usage of Python 3 (scripts with __main__) Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 34/46] tests: Explicit usage of Python 3 Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 35/46] scripts: Explicit usage of Python 3 (scripts with __main__) Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 36/46] scripts/minikconf: Explicit usage of Python 3 Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 37/46] scripts/tracetool: Remove shebang header Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 38/46] tests/acceptance: " Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 39/46] tests/vm: " Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 40/46] tests/qemu-iotests: Explicit usage of Python3 (scripts without __main__) Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 41/46] scripts: Explicit usage of Python 3 " Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 42/46] tests/qemu-iotests/check: Only check for Python 3 interpreter Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 43/46] scripts/signrom: remove Python 2 support, add shebang Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 44/46] make all Python scripts executable Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 45/46] drop "from __future__ import print_function" Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 46/46] .readthedocs.yml: specify some minimum python requirements Philippe Mathieu-Daudé
2020-02-06 22:07 ` [PULL 00/46] Python queue 2020-02-06 Eduardo Habkost
2020-02-07 11:51 ` Peter Maydell
2020-02-07 12:39 ` Philippe Mathieu-Daudé
2020-02-07 14:01 ` Philippe Mathieu-Daudé
2020-02-07 13:30 ` Philippe Mathieu-Daudé
2020-02-07 13:34 ` Philippe Mathieu-Daudé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200206211936.17098-2-philmd@redhat.com \
--to=philmd@redhat.com \
--cc=crosa@redhat.com \
--cc=ehabkost@redhat.com \
--cc=jsnow@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=wainersm@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).