qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC PATCH] python: add __repr__ to ConsoleSocket to aid debugging


From: John Snow
Subject: Re: [RFC PATCH] python: add __repr__ to ConsoleSocket to aid debugging
Date: Mon, 7 Dec 2020 16:02:22 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.3.1

On 12/7/20 3:07 PM, Alex Bennée wrote:
While attempting to debug some console weirdness I thought it would be
worth making it easier to see what it had inside.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
  python/qemu/console_socket.py | 8 ++++++++
  1 file changed, 8 insertions(+)

diff --git a/python/qemu/console_socket.py b/python/qemu/console_socket.py
index f060d79e06..77966d1fe9 100644
--- a/python/qemu/console_socket.py
+++ b/python/qemu/console_socket.py
@@ -45,6 +45,14 @@ class ConsoleSocket(socket.socket):
          if drain:
              self._drain_thread = self._thread_start()
+ def __repr__(self):

def __repr__(self) -> str:

+        s = super(ConsoleSocket, self).__repr__()

Use python3-style super(): super().__repr__()

+        s = s.rstrip(">")
+        s += ", logfile=%s" % (self._logfile)
+        s += ", drain_thread=%s" % (self._drain_thread)
+        s += ">"
+        return s
+

Reviewed-by: John Snow <jsnow@redhat.com>

feel free to take this through your testing tree.

--js




reply via email to

[Prev in Thread] Current Thread [Next in Thread]