From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by sourceware.org (Postfix) with ESMTPS id C2BC93856DF5 for ; Thu, 21 Jul 2022 11:13:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C2BC93856DF5 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 04AA03437C; Thu, 21 Jul 2022 11:13:19 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id DBCC513A1B; Thu, 21 Jul 2022 11:13:18 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id A16FNM402WLLZwAAMHmgww (envelope-from ); Thu, 21 Jul 2022 11:13:18 +0000 Date: Thu, 21 Jul 2022 13:13:17 +0200 From: Tom de Vries To: gdb-patches@sourceware.org Cc: Kevin Buettner , Mark Wielaard Subject: [PATCH][gdb] Fix python selftest with python 3.11 Message-ID: <20220721111316.GA23728@delia.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-12.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jul 2022 11:13:21 -0000 Hi, 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 ... In more detail: ... (gdb) p output $5 = "Traceback (most recent call last):\n File \"\", line 0, \ in \nKeyboardInterrupt\n" (gdb) p ref_output $6 = "Traceback (most recent call last):\n File \"\", line 1, \ in \nKeyboardInterrupt\n" ... Fix this by also allowing line number 0. Tested on x86_64-linux. This should hopefully fix buildbot builder gdb-rawhide-x86_64. Any comments? Thanks, - Tom [gdb] Fix python selftest with python 3.11 --- 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..365859a2e4e 100644 --- a/gdb/python/python.c +++ b/gdb/python/python.c @@ -2240,10 +2240,13 @@ test_python () SELF_CHECK (*e.message == "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 == 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 == ref_output_0 || output == ref_output_1); } #undef CMD