From nobody Fri Nov 14 16:40:30 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1761816627; cv=none; d=zohomail.com; s=zohoarc; b=BNuQHj6P6IY2CWxcdprPMAoavLyTQe8hUzWQKDvFBY7nNrRpXnjZR4h3IMu8l5oNpzL9+jo5wgUWE+EbP2Yy9OHRZqqXayjASBVw5adrA2BBmYJ6Kj4y5QeVTwOo+1VfiW0J1SXqmsVqbqFCIb3T1iPllP1X30FhTENWYVT/OWQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761816627; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=qZhKi2lkS2z8Qf7um+u0aDLSSbPevJX1nqghD0P7VUs=; b=DGBANle5qtI+jLLotjVVkJrSo0esz57C/4TK/RJoPVWWlBzxH3a4ZINMcmPNwGg/btB4kUDpMOE8piTH8W8umbU6FDmSiVLM7BDPZpS8n9nxD2A4Cjuc6E8fSUk+g7jcAwDFMs/0vDGi5d8cX+FIrRSaCSv+/oDm+LmTeWv7OwU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1761816627915160.08058052862702; Thu, 30 Oct 2025 02:30:27 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vEOx1-0003X4-Kb; Thu, 30 Oct 2025 05:28:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vEOww-0003We-U9 for qemu-devel@nongnu.org; Thu, 30 Oct 2025 05:28:07 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vEOvu-0004WY-OC for qemu-devel@nongnu.org; Thu, 30 Oct 2025 05:28:06 -0400 Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-227-R4SNQVJ0MnyHZuk2nd86yQ-1; Thu, 30 Oct 2025 05:26:44 -0400 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id F065119540D1; Thu, 30 Oct 2025 09:26:42 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.45.224.122]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id F06111800579; Thu, 30 Oct 2025 09:26:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761816408; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=qZhKi2lkS2z8Qf7um+u0aDLSSbPevJX1nqghD0P7VUs=; b=ajablx9vu3cuwTHMtM/Aq6tAsnZ/Piqd+OfAgadgjBJQnUXEI2Lzv6apRnNjtN0N0MKyXg gpGoV1zFUkM6HxX5whGEEi8bsgaZsrNvrPeL9261bUyHBOJb4xoJb+mrvT2WLI+b7H4GY7 bAR01kvRr+NZnN4Junx9Wj3cmvFGYKU= X-MC-Unique: R4SNQVJ0MnyHZuk2nd86yQ-1 X-Mimecast-MFC-AGG-ID: R4SNQVJ0MnyHZuk2nd86yQ_1761816403 From: Thomas Huth To: qemu-devel@nongnu.org, =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Peter Xu , Fabiano Rosas Cc: John Snow , Amit Shah , Eduardo Habkost Subject: [PATCH] scripts/vmstate-static-checker: Fix deprecation warnings with latest argparse Date: Thu, 30 Oct 2025 10:26:38 +0100 Message-ID: <20251030092638.39505-1-thuth@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1761816630611154100 From: Thomas Huth The argparse.FileType() type has been deprecated in the latest argparse version (e.g. the one from Fedora 43), now causing the test_bad_vmstate functional test to fail since there are unexpected strings in the output. Change the script to use pathlib.Path instead to fix the test_bad_vmstate test and to be prepared for the future when the deprecated FileType gets removed completely. Reported-by: Daniel P. Berrang=C3=A9 Signed-off-by: Thomas Huth Reviewed-by: Daniel P. Berrang=C3=A9 --- scripts/vmstate-static-checker.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/scripts/vmstate-static-checker.py b/scripts/vmstate-static-che= cker.py index 2335e25f94c..89b100e6cca 100755 --- a/scripts/vmstate-static-checker.py +++ b/scripts/vmstate-static-checker.py @@ -21,6 +21,7 @@ =20 import argparse import json +import pathlib import sys =20 # Count the number of errors found @@ -382,10 +383,10 @@ def main(): help_text =3D "Parse JSON-formatted vmstate dumps from QEMU in files S= RC and DEST. Checks whether migration from SRC to DEST QEMU versions would= break based on the VMSTATE information contained within the JSON outputs. = The JSON output is created from a QEMU invocation with the -dump-vmstate p= arameter and a filename argument to it. Other parameters to QEMU do not ma= tter, except the -M (machine type) parameter." =20 parser =3D argparse.ArgumentParser(description=3Dhelp_text) - parser.add_argument('-s', '--src', type=3Dargparse.FileType('r'), + parser.add_argument('-s', '--src', type=3Dpathlib.Path, required=3DTrue, help=3D'json dump from src qemu') - parser.add_argument('-d', '--dest', type=3Dargparse.FileType('r'), + parser.add_argument('-d', '--dest', type=3Dpathlib.Path, required=3DTrue, help=3D'json dump from dest qemu') parser.add_argument('--reverse', required=3DFalse, default=3DFalse, @@ -393,10 +394,10 @@ def main(): help=3D'reverse the direction') args =3D parser.parse_args() =20 - src_data =3D json.load(args.src) - dest_data =3D json.load(args.dest) - args.src.close() - args.dest.close() + with open(args.src, 'r', encoding=3D'utf-8') as src_fh: + src_data =3D json.load(src_fh) + with open(args.dest, 'r', encoding=3D'utf-8') as dst_fh: + dest_data =3D json.load(dst_fh) =20 if args.reverse: temp =3D src_data --=20 2.51.0