public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Cc: Kevin Buettner <kevinb@redhat.com>, Mark Wielaard <mark@gcc.gnu.org>
Subject: [PATCH][gdb] Fix python selftest with python 3.11
Date: Thu, 21 Jul 2022 13:13:17 +0200	[thread overview]
Message-ID: <20220721111316.GA23728@delia.home> (raw)

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 \"<string>\", line 0, \
  in <module>\nKeyboardInterrupt\n"
(gdb) p ref_output
$6 = "Traceback (most recent call last):\n  File \"<string>\", line 1, \
  in <module>\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 \"<string>\", line 1, in <module>\n"
-			   "KeyboardInterrupt\n");
-    SELF_CHECK (output == ref_output);
+    std::string ref_output_0("Traceback (most recent call last):\n"
+			     "  File \"<string>\", line 0, in <module>\n"
+			     "KeyboardInterrupt\n");
+    std::string ref_output_1("Traceback (most recent call last):\n"
+			     "  File \"<string>\", line 1, in <module>\n"
+			     "KeyboardInterrupt\n");
+    SELF_CHECK (output == ref_output_0 || output == ref_output_1);
   }
 
 #undef CMD

             reply	other threads:[~2022-07-21 11:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-21 11:13 Tom de Vries [this message]
2022-07-21 11:42 ` Mark Wielaard
2022-07-21 12:06   ` Tom de Vries
2022-07-21 12:36     ` Mark Wielaard
2022-07-21 12:55       ` Tom de Vries

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220721111316.GA23728@delia.home \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    --cc=kevinb@redhat.com \
    --cc=mark@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).