qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PULL 0/2] Python patches
@ 2021-09-16 22:07 John Snow
  2021-09-20 15:16 ` Peter Maydell
  0 siblings, 1 reply; 9+ messages in thread
From: John Snow @ 2021-09-16 22:07 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Thomas Huth, Daniel Berrange, Eduardo Habkost,
	Alex Bennée, Markus Armbruster, Wainer dos Santos Moschetta,
	Philippe Mathieu-Daudé, Willian Rampazzo, Cleber Rosa,
	John Snow

The following changes since commit 831aaf24967a49d7750090b9dcfd6bf356f16529:

  Merge remote-tracking branch 'remotes/marcandre/tags/misc-pull-request' into staging (2021-09-14 18:14:56 +0100)

are available in the Git repository at:

  https://gitlab.com/jsnow/qemu.git tags/python-pull-request

for you to fetch changes up to eb8033f658e8b6f23ba9f4ef4a1b55894f7ea486:

  python: pylint 2.11 support (2021-09-16 15:04:04 -0400)

----------------------------------------------------------------
Python Pull request

This fixes the check-python-tox job.

CI including optional jobs is all green:
https://gitlab.com/jsnow/qemu/-/pipelines/372151147

----------------------------------------------------------------

John Snow (2):
  python: Update for pylint 2.10
  python: pylint 2.11 support

 python/qemu/machine/machine.py | 7 ++++++-
 python/setup.cfg               | 3 ++-
 2 files changed, 8 insertions(+), 2 deletions(-)

-- 
2.31.1




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PULL 0/2] Python patches
  2021-09-16 22:07 John Snow
@ 2021-09-20 15:16 ` Peter Maydell
  0 siblings, 0 replies; 9+ messages in thread
From: Peter Maydell @ 2021-09-20 15:16 UTC (permalink / raw)
  To: John Snow
  Cc: Thomas Huth, Daniel Berrange, Eduardo Habkost, QEMU Developers,
	Wainer dos Santos Moschetta, Markus Armbruster, Willian Rampazzo,
	Cleber Rosa, Alex Bennée, Philippe Mathieu-Daudé

On Thu, 16 Sept 2021 at 23:07, John Snow <jsnow@redhat.com> wrote:
>
> The following changes since commit 831aaf24967a49d7750090b9dcfd6bf356f16529:
>
>   Merge remote-tracking branch 'remotes/marcandre/tags/misc-pull-request' into staging (2021-09-14 18:14:56 +0100)
>
> are available in the Git repository at:
>
>   https://gitlab.com/jsnow/qemu.git tags/python-pull-request
>
> for you to fetch changes up to eb8033f658e8b6f23ba9f4ef4a1b55894f7ea486:
>
>   python: pylint 2.11 support (2021-09-16 15:04:04 -0400)
>
> ----------------------------------------------------------------
> Python Pull request
>
> This fixes the check-python-tox job.
>
> CI including optional jobs is all green:
> https://gitlab.com/jsnow/qemu/-/pipelines/372151147
>


Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/6.2
for any user-visible changes.

-- PMM


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PULL 0/2] Python patches
@ 2023-02-23  4:36 John Snow
  2023-02-24 15:07 ` Peter Maydell
  0 siblings, 1 reply; 9+ messages in thread
From: John Snow @ 2023-02-23  4:36 UTC (permalink / raw)
  To: qemu-devel
  Cc: Hanna Reitz, Beraldo Leal, Markus Armbruster, Peter Maydell,
	Thomas Huth, John Snow, Eduardo Habkost, Kevin Wolf,
	Vladimir Sementsov-Ogievskiy, Philippe Mathieu-Daudé,
	Wainer dos Santos Moschetta, Alex Bennée, qemu-block,
	Cleber Rosa

The following changes since commit 79b677d658d3d35e1e776826ac4abb28cdce69b8:

  Merge tag 'net-pull-request' of https://github.com/jasowang/qemu into staging (2023-02-21 11:28:31 +0000)

are available in the Git repository at:

  https://gitlab.com/jsnow/qemu.git tags/python-pull-request

for you to fetch changes up to 6832189fd791622c30e7bbe3a12b76be14dc1158:

  python: drop pipenv (2023-02-22 23:35:03 -0500)

----------------------------------------------------------------
Python

Only minor testing updates.

----------------------------------------------------------------

John Snow (2):
  python: support pylint 2.16
  python: drop pipenv

 python/README.rst                             |   3 -
 .gitlab-ci.d/static_checks.yml                |   4 +-
 python/.gitignore                             |   4 +-
 python/Makefile                               |  53 ++-
 python/Pipfile                                |  13 -
 python/Pipfile.lock                           | 347 ------------------
 python/qemu/qmp/protocol.py                   |   2 +-
 python/qemu/qmp/qmp_client.py                 |   2 +-
 python/qemu/utils/qemu_ga_client.py           |   6 +-
 python/setup.cfg                              |   4 +-
 python/tests/minreqs.txt                      |  45 +++
 tests/docker/dockerfiles/python.docker        |   1 -
 tests/qemu-iotests/iotests.py                 |   4 +-
 .../tests/migrate-bitmaps-postcopy-test       |   2 +-
 14 files changed, 94 insertions(+), 396 deletions(-)
 delete mode 100644 python/Pipfile
 delete mode 100644 python/Pipfile.lock
 create mode 100644 python/tests/minreqs.txt

-- 
2.39.0




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PULL 0/2] Python patches
  2023-02-23  4:36 John Snow
@ 2023-02-24 15:07 ` Peter Maydell
  0 siblings, 0 replies; 9+ messages in thread
From: Peter Maydell @ 2023-02-24 15:07 UTC (permalink / raw)
  To: John Snow
  Cc: qemu-devel, Hanna Reitz, Beraldo Leal, Markus Armbruster,
	Thomas Huth, Eduardo Habkost, Kevin Wolf,
	Vladimir Sementsov-Ogievskiy, Philippe Mathieu-Daudé,
	Wainer dos Santos Moschetta, Alex Bennée, qemu-block,
	Cleber Rosa

On Thu, 23 Feb 2023 at 04:36, John Snow <jsnow@redhat.com> wrote:
>
> The following changes since commit 79b677d658d3d35e1e776826ac4abb28cdce69b8:
>
>   Merge tag 'net-pull-request' of https://github.com/jasowang/qemu into staging (2023-02-21 11:28:31 +0000)
>
> are available in the Git repository at:
>
>   https://gitlab.com/jsnow/qemu.git tags/python-pull-request
>
> for you to fetch changes up to 6832189fd791622c30e7bbe3a12b76be14dc1158:
>
>   python: drop pipenv (2023-02-22 23:35:03 -0500)
>
> ----------------------------------------------------------------
> Python
>
> Only minor testing updates.
>


Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/8.0
for any user-visible changes.

-- PMM


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PULL 0/2] Python patches
@ 2025-08-20  4:58 John Snow
  2025-08-20  4:58 ` [PULL 1/2] python: Replace asyncio.get_event_loop for Python 3.14 John Snow
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: John Snow @ 2025-08-20  4:58 UTC (permalink / raw)
  To: qemu-devel
  Cc: Cleber Rosa, Peter Maydell, Michael Roth, Markus Armbruster,
	John Snow

The following changes since commit 5836af0783213b9355a6bbf85d9e6bc4c9c9363f:

  Merge tag 'uefi-20250812-pull-request' of https://gitlab.com/kraxel/qemu into staging (2025-08-13 15:19:29 -0400)

are available in the Git repository at:

  https://gitlab.com/jsnow/qemu.git tags/python-pull-request

for you to fetch changes up to 16398e73cd13c7d9f284d8ec4a440778fc2e3f9a:

  python: avoid deprecation warning with get_event_loop (2025-08-20 00:55:27 -0400)

----------------------------------------------------------------
Python pull request

Necessary for Python 3.14 support for iotests, releasing October 7th

----------------------------------------------------------------

Daniel P. Berrangé (1):
  python: avoid deprecation warning with get_event_loop

Richard W.M. Jones (1):
  python: Replace asyncio.get_event_loop for Python 3.14

 python/qemu/qmp/legacy.py  | 10 +++++++++-
 python/qemu/qmp/qmp_tui.py |  2 +-
 python/tests/protocol.py   |  2 +-
 3 files changed, 11 insertions(+), 3 deletions(-)

-- 
2.50.1




^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PULL 1/2] python: Replace asyncio.get_event_loop for Python 3.14
  2025-08-20  4:58 [PULL 0/2] Python patches John Snow
@ 2025-08-20  4:58 ` John Snow
  2025-08-20  4:58 ` [PULL 2/2] python: avoid deprecation warning with get_event_loop John Snow
  2025-08-20  5:01 ` [PULL 0/2] Python patches John Snow
  2 siblings, 0 replies; 9+ messages in thread
From: John Snow @ 2025-08-20  4:58 UTC (permalink / raw)
  To: qemu-devel
  Cc: Cleber Rosa, Peter Maydell, Michael Roth, Markus Armbruster,
	John Snow, Richard W.M. Jones

From: "Richard W.M. Jones" <rjones@redhat.com>

In Python 3.14, no asyncio event loop gets generated automatically.
Instead create one when we need it.  This should work with Python 3.13
as well.  This change was suggested here:

https://bugzilla.redhat.com/show_bug.cgi?id=2375004#c4

See-also: https://docs.python.org/3.14/whatsnew/3.14.html#id7
Thanks: Miro Hrončok, Daniel P. Berrangé
Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: John Snow <jsnow@redhat.com>
---
 python/qemu/qmp/legacy.py  | 5 ++++-
 python/qemu/qmp/qmp_tui.py | 2 +-
 python/tests/protocol.py   | 2 +-
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/python/qemu/qmp/legacy.py b/python/qemu/qmp/legacy.py
index 22a2b5616ef..e11d05afbd6 100644
--- a/python/qemu/qmp/legacy.py
+++ b/python/qemu/qmp/legacy.py
@@ -86,7 +86,10 @@ def __init__(self,
                 "server argument should be False when passing a socket")
 
         self._qmp = QMPClient(nickname)
-        self._aloop = asyncio.get_event_loop()
+        try:
+            self._aloop = asyncio.get_event_loop()
+        except RuntimeError:
+            self._aloop = asyncio.new_event_loop()
         self._address = address
         self._timeout: Optional[float] = None
 
diff --git a/python/qemu/qmp/qmp_tui.py b/python/qemu/qmp/qmp_tui.py
index 2d9ebbd20bc..7dfb03c9ad5 100644
--- a/python/qemu/qmp/qmp_tui.py
+++ b/python/qemu/qmp/qmp_tui.py
@@ -377,7 +377,7 @@ def run(self, debug: bool = False) -> None:
         screen = urwid.raw_display.Screen()
         screen.set_terminal_properties(256)
 
-        self.aloop = asyncio.get_event_loop()
+        self.aloop = asyncio.new_event_loop()
         self.aloop.set_debug(debug)
 
         # Gracefully handle SIGTERM and SIGINT signals
diff --git a/python/tests/protocol.py b/python/tests/protocol.py
index 56c4d441f9c..db5d54d83f4 100644
--- a/python/tests/protocol.py
+++ b/python/tests/protocol.py
@@ -228,7 +228,7 @@ def async_test(async_test_method):
         Decorator; adds SetUp and TearDown to async tests.
         """
         async def _wrapper(self, *args, **kwargs):
-            loop = asyncio.get_event_loop()
+            loop = asyncio.new_event_loop()
             loop.set_debug(True)
 
             await self._asyncSetUp()
-- 
2.50.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PULL 2/2] python: avoid deprecation warning with get_event_loop
  2025-08-20  4:58 [PULL 0/2] Python patches John Snow
  2025-08-20  4:58 ` [PULL 1/2] python: Replace asyncio.get_event_loop for Python 3.14 John Snow
@ 2025-08-20  4:58 ` John Snow
  2025-08-20  5:01 ` [PULL 0/2] Python patches John Snow
  2 siblings, 0 replies; 9+ messages in thread
From: John Snow @ 2025-08-20  4:58 UTC (permalink / raw)
  To: qemu-devel
  Cc: Cleber Rosa, Peter Maydell, Michael Roth, Markus Armbruster,
	John Snow, Daniel P. Berrangé, Eric Blake

From: Daniel P. Berrangé <berrange@redhat.com>

We need to call get_event_loop but have no way of knowing ahead
of time whether the current thread has an event loop of not. We
can handle a missing event loop, but we need to hide the warning
python will emit to avoid tripping up iotests expected output.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: John Snow <jsnow@redhat.com>
---
 python/qemu/qmp/legacy.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/python/qemu/qmp/legacy.py b/python/qemu/qmp/legacy.py
index e11d05afbd6..c6ab3edc867 100644
--- a/python/qemu/qmp/legacy.py
+++ b/python/qemu/qmp/legacy.py
@@ -34,6 +34,7 @@
     TypeVar,
     Union,
 )
+import warnings
 
 from .error import QMPError
 from .protocol import Runstate, SocketAddrT
@@ -87,7 +88,11 @@ def __init__(self,
 
         self._qmp = QMPClient(nickname)
         try:
-            self._aloop = asyncio.get_event_loop()
+            with warnings.catch_warnings():
+                # Python <= 3.13 will trigger deprecation warnings
+                # if no event loop is set
+                warnings.simplefilter("ignore")
+                self._aloop = asyncio.get_event_loop()
         except RuntimeError:
             self._aloop = asyncio.new_event_loop()
         self._address = address
-- 
2.50.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PULL 0/2] Python patches
  2025-08-20  4:58 [PULL 0/2] Python patches John Snow
  2025-08-20  4:58 ` [PULL 1/2] python: Replace asyncio.get_event_loop for Python 3.14 John Snow
  2025-08-20  4:58 ` [PULL 2/2] python: avoid deprecation warning with get_event_loop John Snow
@ 2025-08-20  5:01 ` John Snow
  2025-08-20 13:33   ` Daniel P. Berrangé
  2 siblings, 1 reply; 9+ messages in thread
From: John Snow @ 2025-08-20  5:01 UTC (permalink / raw)
  To: qemu-devel, Daniel Berrangé
  Cc: Cleber Rosa, Peter Maydell, Michael Roth, Markus Armbruster

On Wed, Aug 20, 2025 at 12:58 AM John Snow <jsnow@redhat.com> wrote:
>
> The following changes since commit 5836af0783213b9355a6bbf85d9e6bc4c9c9363f:
>
>   Merge tag 'uefi-20250812-pull-request' of https://gitlab.com/kraxel/qemu into staging (2025-08-13 15:19:29 -0400)
>
> are available in the Git repository at:
>
>   https://gitlab.com/jsnow/qemu.git tags/python-pull-request
>
> for you to fetch changes up to 16398e73cd13c7d9f284d8ec4a440778fc2e3f9a:
>
>   python: avoid deprecation warning with get_event_loop (2025-08-20 00:55:27 -0400)
>
> ----------------------------------------------------------------
> Python pull request
>
> Necessary for Python 3.14 support for iotests, releasing October 7th
>
> ----------------------------------------------------------------
>
> Daniel P. Berrangé (1):
>   python: avoid deprecation warning with get_event_loop
>
> Richard W.M. Jones (1):
>   python: Replace asyncio.get_event_loop for Python 3.14
>
>  python/qemu/qmp/legacy.py  | 10 +++++++++-
>  python/qemu/qmp/qmp_tui.py |  2 +-
>  python/tests/protocol.py   |  2 +-
>  3 files changed, 11 insertions(+), 3 deletions(-)
>
> --
> 2.50.1
>

Dan: I wasn't sure if you were suggesting these to be pulled *right
away*, but just in case that is what you meant, I sent this PR for
what I think is the minimum necessary to avoid iotests croaking when
3.14 drops in October. Let me know if we need to make any other
adjustments here and I will follow up in the morning.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PULL 0/2] Python patches
  2025-08-20  5:01 ` [PULL 0/2] Python patches John Snow
@ 2025-08-20 13:33   ` Daniel P. Berrangé
  0 siblings, 0 replies; 9+ messages in thread
From: Daniel P. Berrangé @ 2025-08-20 13:33 UTC (permalink / raw)
  To: John Snow
  Cc: qemu-devel, Cleber Rosa, Peter Maydell, Michael Roth,
	Markus Armbruster

On Wed, Aug 20, 2025 at 01:01:06AM -0400, John Snow wrote:
> On Wed, Aug 20, 2025 at 12:58 AM John Snow <jsnow@redhat.com> wrote:
> >
> > The following changes since commit 5836af0783213b9355a6bbf85d9e6bc4c9c9363f:
> >
> >   Merge tag 'uefi-20250812-pull-request' of https://gitlab.com/kraxel/qemu into staging (2025-08-13 15:19:29 -0400)
> >
> > are available in the Git repository at:
> >
> >   https://gitlab.com/jsnow/qemu.git tags/python-pull-request
> >
> > for you to fetch changes up to 16398e73cd13c7d9f284d8ec4a440778fc2e3f9a:
> >
> >   python: avoid deprecation warning with get_event_loop (2025-08-20 00:55:27 -0400)
> >
> > ----------------------------------------------------------------
> > Python pull request
> >
> > Necessary for Python 3.14 support for iotests, releasing October 7th
> >
> > ----------------------------------------------------------------
> >
> > Daniel P. Berrangé (1):
> >   python: avoid deprecation warning with get_event_loop
> >
> > Richard W.M. Jones (1):
> >   python: Replace asyncio.get_event_loop for Python 3.14
> >
> >  python/qemu/qmp/legacy.py  | 10 +++++++++-
> >  python/qemu/qmp/qmp_tui.py |  2 +-
> >  python/tests/protocol.py   |  2 +-
> >  3 files changed, 11 insertions(+), 3 deletions(-)
> >
> > --
> > 2.50.1
> >
> 
> Dan: I wasn't sure if you were suggesting these to be pulled *right
> away*, but just in case that is what you meant, I sent this PR for
> what I think is the minimum necessary to avoid iotests croaking when
> 3.14 drops in October. Let me know if we need to make any other
> adjustments here and I will follow up in the morning.

Only the 1st patch is important for the 10.1.0 release - the 2nd patch
doesn't take effect until the rest of my py series that explicitly
turns on warnings for iotests/functional tests.

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2025-08-20 13:34 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-20  4:58 [PULL 0/2] Python patches John Snow
2025-08-20  4:58 ` [PULL 1/2] python: Replace asyncio.get_event_loop for Python 3.14 John Snow
2025-08-20  4:58 ` [PULL 2/2] python: avoid deprecation warning with get_event_loop John Snow
2025-08-20  5:01 ` [PULL 0/2] Python patches John Snow
2025-08-20 13:33   ` Daniel P. Berrangé
  -- strict thread matches above, loose matches on Subject: below --
2023-02-23  4:36 John Snow
2023-02-24 15:07 ` Peter Maydell
2021-09-16 22:07 John Snow
2021-09-20 15:16 ` Peter Maydell

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).