On Thu, Jan 15, 2026 at 11:48 AM Daniel P. Berrangé <[email protected]> wrote:
>
> This reverts commit a57cb3e23d5ac918a69d0aab918470ff0b429ff9.
>
> The current code now only requires compatibility with Python
> 3.8 or later.
>
> The conditional usage of 'sendmsg' on the async IO socket
> wrapper will generate a deprecation warning on stderr
> every time send_fd_scm is used with older Python versions.
>
> This has the effect of breaking the QEMU I/O tests when run
> on Python versions before the 'sendmsg' wrapper was removed.
>
> Unconditionally accessing 'sock._sock' ensures we never use
> the asyncio socket wrapper, and thus never risk triggering
> deprecation warnings on any Python version
>
> Most notably this fixes the QEMU block I/O tests on CentOS
> Stream9 that use "sendmsg" for FD passing, which otherwise
> generate deprecation messages breaking the expected output
> comparison.
>
> Reviewed-by: Thomas Huth <[email protected]>
> Acked-by: John Snow <[email protected]>
> Signed-off-by: Daniel P. Berrangé <[email protected]>
> ---
>  python/qemu/qmp/qmp_client.py | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/python/qemu/qmp/qmp_client.py b/python/qemu/qmp/qmp_client.py
> index 8beccfe29d..7a115b693b 100644
> --- a/python/qemu/qmp/qmp_client.py
> +++ b/python/qemu/qmp/qmp_client.py
> @@ -720,12 +720,9 @@ def send_fd_scm(self, fd: int) -> None:
>          if sock.family != socket.AF_UNIX:
>              raise QMPError("Sending file descriptors requires a UNIX 
> socket.")
>
> -        if not hasattr(sock, 'sendmsg'):
> -            # We need to void the warranty sticker.
> -            # Access to sendmsg is scheduled for removal in Python 3.11.
> -            # Find the real backing socket to use it anyway.
> -            sock = sock._sock  # pylint: disable=protected-access
> -
> +        # Void the warranty sticker.
> +        # Access to sendmsg in asyncio is scheduled for removal in Python 
> 3.11.
> +        sock = sock._sock  # pylint: disable=protected-access
>          sock.sendmsg(
>              [b' '],
>              [(socket.SOL_SOCKET, socket.SCM_RIGHTS, struct.pack('@i', fd))]
> --
> 2.52.0
>

Acked-by: John Snow <[email protected]>

PS, for your other qemu.qmp fix, it can go in as soon as the pipeline
is fixed, which I (think) I have accomplished here:
https://gitlab.com/qemu-project/python-qemu-qmp/-/merge_requests/47

Sorry for the delay on that.

--js


Reply via email to