From: "Alex Bennée" <alex.bennee@linaro.org>
To: qemu-devel@nongnu.org
Cc: fam@euphon.net, berrange@redhat.com,
"Eduardo Habkost" <ehabkost@redhat.com>,
"Alex Bennée" <alex.bennee@linaro.org>,
f4bug@amsat.org, stefanha@redhat.com, crosa@redhat.com,
pbonzini@redhat.com, "John Snow" <jsnow@redhat.com>,
aurelien@aurel32.net
Subject: [PATCH v1 06/11] python: Update for pylint 2.10
Date: Fri, 17 Sep 2021 17:23:27 +0100 [thread overview]
Message-ID: <20210917162332.3511179-7-alex.bennee@linaro.org> (raw)
In-Reply-To: <20210917162332.3511179-1-alex.bennee@linaro.org>
From: John Snow <jsnow@redhat.com>
A few new annoyances. Of note is the new warning for an unspecified
encoding when opening a text file, which actually does indicate a
potentially real problem; see
https://www.python.org/dev/peps/pep-0597/#motivation
Use LC_CTYPE to determine an encoding to use for interpreting QEMU's
terminal output. Note that Python states: "language code and encoding
may be None if their values cannot be determined" -- use a platform
default as a backup.
Signed-off-by: John Snow <jsnow@redhat.com>
Message-Id: <20210916040955.628560-2-jsnow@redhat.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Tested-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
python/qemu/machine/machine.py | 9 ++++++++-
python/setup.cfg | 1 +
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/python/qemu/machine/machine.py b/python/qemu/machine/machine.py
index a7081b1845..51b6e79a13 100644
--- a/python/qemu/machine/machine.py
+++ b/python/qemu/machine/machine.py
@@ -19,6 +19,7 @@
import errno
from itertools import chain
+import locale
import logging
import os
import shutil
@@ -290,8 +291,14 @@ def get_pid(self) -> Optional[int]:
return self._subp.pid
def _load_io_log(self) -> None:
+ # Assume that the output encoding of QEMU's terminal output
+ # is defined by our locale. If indeterminate, use a platform default.
+ _, encoding = locale.getlocale()
+ if encoding is None:
+ encoding = locale.getpreferredencoding(do_setlocale=False)
if self._qemu_log_path is not None:
- with open(self._qemu_log_path, "r") as iolog:
+ with open(self._qemu_log_path, "r",
+ encoding=encoding) as iolog:
self._iolog = iolog.read()
@property
diff --git a/python/setup.cfg b/python/setup.cfg
index 83909c1c97..0f0cab098f 100644
--- a/python/setup.cfg
+++ b/python/setup.cfg
@@ -104,6 +104,7 @@ good-names=i,
[pylint.similarities]
# Ignore imports when computing similarities.
ignore-imports=yes
+ignore-signatures=yes
# Minimum lines number of a similarity.
# TODO: Remove after we opt in to Pylint 2.8.3. See commit msg.
--
2.30.2
next prev parent reply other threads:[~2021-09-17 16:33 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-17 16:23 [PATCH v1 00/11] testing and plugin pre-PR (configure, gitlab, plugins) Alex Bennée
2021-09-17 16:23 ` [PATCH v1 01/11] configure: don't override the selected host test compiler if defined Alex Bennée
2021-09-17 17:04 ` Warner Losh
2021-09-20 14:46 ` Ed Maste
2021-09-20 16:37 ` Alex Bennée
2021-09-17 16:23 ` [PATCH v1 02/11] tests/tcg/sha1: remove endian include Alex Bennée
2021-09-17 16:23 ` [PATCH v1 03/11] tests/tcg: move some multiarch files and make conditional Alex Bennée
2021-09-17 17:05 ` Warner Losh
2021-09-17 20:38 ` Philippe Mathieu-Daudé
2021-09-17 16:23 ` [PATCH v1 04/11] tests/docker: promote debian-riscv64-cross to a full image Alex Bennée
2021-09-17 16:23 ` [PATCH v1 05/11] gitlab: Add cross-riscv64-system, cross-riscv64-user Alex Bennée
2021-09-17 18:33 ` Philippe Mathieu-Daudé
2021-09-17 16:23 ` Alex Bennée [this message]
2021-09-17 16:29 ` [PATCH v1 06/11] python: Update for pylint 2.10 John Snow
2021-09-17 16:23 ` [PATCH v1 07/11] travis.yml: Remove the "Release tarball" job Alex Bennée
2021-09-17 16:23 ` [PATCH v1 08/11] gitlab: skip the check-patch job on the upstream repo Alex Bennée
2021-09-17 16:23 ` [PATCH v1 09/11] gitlab: fix passing of TEST_TARGETS env to cirrus Alex Bennée
2021-09-17 16:23 ` [PATCH v1 10/11] plugins/: Add missing functions to symbol list Alex Bennée
2021-09-17 16:23 ` [PATCH v1 11/11] accel/tcg: re-factor plugin_inject_cb so we can assert insn_idx is valid Alex Bennée
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=20210917162332.3511179-7-alex.bennee@linaro.org \
--to=alex.bennee@linaro.org \
--cc=aurelien@aurel32.net \
--cc=berrange@redhat.com \
--cc=crosa@redhat.com \
--cc=ehabkost@redhat.com \
--cc=f4bug@amsat.org \
--cc=fam@euphon.net \
--cc=jsnow@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@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).