From nobody Mon Feb 9 12:29:09 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.221.54 as permitted sender) client-ip=209.85.221.54; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-f54.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.54 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com; dmarc=fail(p=none dis=none) header.from=amsat.org ARC-Seal: i=1; a=rsa-sha256; t=1610118996; cv=none; d=zohomail.com; s=zohoarc; b=QN5fCh3Hzou2Qz8fyTKvu0CtVtGwWpbV8IWl5zAdbfxdRyfw2dClePII6z8TUZ49R2Jvp0BqiqA7WNd9+oha/tgHZNVDfzxHP0GtiYawIi4PUMmROO3xbC+Uuo5lPEYy338hXJimB13cNi2oeEbDPTuuaSZjYkV5fNZxYY9i2AE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610118996; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:MIME-Version:Message-ID:Sender:Subject:To; bh=MorWNuq47M/K8vM/SaYtobIREpFwkkpIJwzUuntcTXE=; b=YxtKULtY2IdP/WahhVqGYXw/eMxbXdIaeIfAkQ7w+IZRbT9pGxev3A1JQhaXHHFHoBaKed+voSo3NuzzysMIyoiEYOdnY8BZIrD1qygJ0uhN8fz2Z/0xoyrcIRWpYZmpj8LM48S/T/R8rNFbP1Slv27QkBDktk6e0x5+LGsZc7w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.54 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) by mx.zohomail.com with SMTPS id 1610118996469500.4864361519758; Fri, 8 Jan 2021 07:16:36 -0800 (PST) Received: by mail-wr1-f54.google.com with SMTP id r7so9348581wrc.5 for ; Fri, 08 Jan 2021 07:16:35 -0800 (PST) Return-Path: Return-Path: Received: from x1w.redhat.com (241.red-88-10-103.dynamicip.rima-tde.net. [88.10.103.241]) by smtp.gmail.com with ESMTPSA id v189sm13186986wmg.14.2021.01.08.07.16.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Jan 2021 07:16:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=MorWNuq47M/K8vM/SaYtobIREpFwkkpIJwzUuntcTXE=; b=NnwyqLcqejcTwRG/p7FYwr3OK6aoTTjRjr3hnY75oNYkyYj3XEv2l1J21r58YuBwlG yGNqgN6Dh1aPb+cOdkPkdrDMwbJV9aH/DnsjVgWQUBzBAgpoULuaXxIzPHs80HReNsIh Tka/BSzJ6yGM6EkNlX7vzmoxlkSF+WO/f3EJKKwXB4cPo+0w2YIc7hFcrulJ5xaoYQQs w48RsloVhaNJHQloHrTk6cYlEI92p0KFHKoIRCbNx2oHavWiTlqA0wt60Qg3P+Ya8XF0 H8L3OCs/PEcZx6h8A+fEpJX0WVlSdRUNVhe5wP57lL2OnBW5q1bPy+A6JvJJNIyMdd4d aWiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=MorWNuq47M/K8vM/SaYtobIREpFwkkpIJwzUuntcTXE=; b=ndMkv9t6DvKCN69J1TVzIdhDCJQ+XlsJx6u/X8iHvdFRkzZxtuYyXSkJPJKob1RN0C EiuiB7da1x/Y/1StQpYtduy/uJi6544XwTFpOmycYYerJiRUC+iBiclac/+HshW86qlS yY8nK0tyZesIkfvK63R1Wuzl1gGsGUVolEOI0Y+iCtvKFJFrHamuEZ/4LqkdHzLC76Gb lklHvh3dRgoWRIbb5eM1appFJoBi53+vrneH+T8wcml4eEFI5KltcQuFr/awyc5wcItx GZpLz+WOwdJJKV0BhHqHGpnnAfWQ10ql3XpveIUw21mmtAf5JMwiAfVeKqQXCLWI4lfE 5FDQ== X-Gm-Message-State: AOAM531s2T3gPG6eqIcBJM43/bZfASkfxpm8iz8KstQy6Gxn6YmQZFin 6+MsPnpJoMRfsLDSTjuQ4Mg= X-Google-Smtp-Source: ABdhPJznAAc9Xs9ThgbVZnq/zaenbfqBIfSVOY684VElxU5j/oEKcs2OXk7SvJZYzCGvz3+CxTm+Rg== X-Received: by 2002:a5d:4882:: with SMTP id g2mr4061602wrq.273.1610118994662; Fri, 08 Jan 2021 07:16:34 -0800 (PST) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Richard Henderson , Paolo Bonzini , Cleber Rosa , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Peter Maydell Subject: [PATCH] decodetree: Open files with encoding='utf-8' Date: Fri, 8 Jan 2021 16:16:32 +0100 Message-Id: <20210108151632.277015-1-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) When decodetree.py was added in commit 568ae7efae7, QEMU was using Python 2 which happily reads UTF-8 files in text mode. Python 3 requires either UTF-8 locale or an explicit encoding passed to open(). Now that Python 3 is required, explicit UTF-8 encoding for decodetree sources. This fixes: $ /usr/bin/python3 scripts/decodetree.py test.decode Traceback (most recent call last): File "scripts/decodetree.py", line 1397, in main() File "scripts/decodetree.py", line 1308, in main parse_file(f, toppat) File "scripts/decodetree.py", line 994, in parse_file for line in f: File "/usr/lib/python3.6/encodings/ascii.py", line 26, in decode return codecs.ascii_decode(input, self.errors)[0] UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 80: ordinal not in range(128) Reported-by: Peter Maydell Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Yonggang Luo uoyonggang@gmail.com --- scripts/decodetree.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/decodetree.py b/scripts/decodetree.py index 47aa9caf6d1..fa40903cff1 100644 --- a/scripts/decodetree.py +++ b/scripts/decodetree.py @@ -1304,7 +1304,7 @@ def main(): =20 for filename in args: input_file =3D filename - f =3D open(filename, 'r') + f =3D open(filename, 'r', encoding=3D'utf-8') parse_file(f, toppat) f.close() =20 --=20 2.26.2