From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2205) id A757E3858D28; Thu, 21 Jul 2022 12:04:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A757E3858D28 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom de Vries To: gdb-cvs@sourceware.org Subject: [binutils-gdb] [gdb/python] Fix python selftest with python 3.11 X-Act-Checkin: binutils-gdb X-Git-Author: Tom de Vries X-Git-Refname: refs/heads/master X-Git-Oldrev: 9b89bf16c39365ac68929ca5d8484ef732e0ac4f X-Git-Newrev: c57ac5108667b52f5cde6c1bbdd4a1496626c1a8 Message-Id: <20220721120444.A757E3858D28@sourceware.org> Date: Thu, 21 Jul 2022 12:04:44 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jul 2022 12:04:44 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Dc57ac5108667= b52f5cde6c1bbdd4a1496626c1a8 commit c57ac5108667b52f5cde6c1bbdd4a1496626c1a8 Author: Tom de Vries Date: Thu Jul 21 14:04:41 2022 +0200 [gdb/python] Fix python selftest with python 3.11 =20 With python 3.11 I noticed: ... $ gdb -q -batch -ex "maint selftest python" Running selftest python. Self test failed: self-test failed at gdb/python/python.c:2246 Ran 1 unit tests, 1 failed ... =20 In more detail: ... (gdb) p output $5 =3D "Traceback (most recent call last):\n File \"\", line 0= , \ in \nKeyboardInterrupt\n" (gdb) p ref_output $6 =3D "Traceback (most recent call last):\n File \"\", line 1= , \ in \nKeyboardInterrupt\n" ... =20 Fix this by also allowing line number 0. =20 Tested on x86_64-linux. =20 This should hopefully fix buildbot builder gdb-rawhide-x86_64. Diff: --- gdb/python/python.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/gdb/python/python.c b/gdb/python/python.c index 8fa935c8286..c0312413a73 100644 --- a/gdb/python/python.c +++ b/gdb/python/python.c @@ -2240,10 +2240,13 @@ test_python () SELF_CHECK (*e.message =3D=3D "Error while executing Python code."); } SELF_CHECK (saw_exception); - std::string ref_output("Traceback (most recent call last):\n" - " File \"\", line 1, in \n" - "KeyboardInterrupt\n"); - SELF_CHECK (output =3D=3D ref_output); + std::string ref_output_0 ("Traceback (most recent call last):\n" + " File \"\", line 0, in \n" + " KeyboardInterrupt\n"); + std::string ref_output_1 ("Traceback (most recent call last):\n" + " File \"\", line 1, in \n" + "KeyboardInterrupt\n"); + SELF_CHECK (output =3D=3D ref_output_0 || output =3D=3D ref_output_1); } =20 #undef CMD