public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] [gdb/python] Fix python selftest with python 3.11
@ 2022-07-21 12:04 Tom de Vries
  0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2022-07-21 12:04 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=c57ac5108667b52f5cde6c1bbdd4a1496626c1a8

commit c57ac5108667b52f5cde6c1bbdd4a1496626c1a8
Author: Tom de Vries <tdevries@suse.de>
Date:   Thu Jul 21 14:04:41 2022 +0200

    [gdb/python] Fix python selftest with python 3.11
    
    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.

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 == "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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-07-21 12:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-21 12:04 [binutils-gdb] [gdb/python] Fix python selftest with python 3.11 Tom de Vries

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).