Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [PATCH] [gdb/testsuite] Fix gdb.python/py-failed-init.exp with python 3.15
Date: Wed,  5 Aug 2026 15:36:39 +0200	[thread overview]
Message-ID: <20260805133639.1532690-1-tdevries@suse.de> (raw)

On Fedora Rawhide aarch64-linux, I ran into:
...
builtin_spawn $build/gdb/gdb -nw -nx -q -iex set height 0 -iex set width 0 \
  -data-directory $build/gdb/data-directory -iex set interactive-mode on
WARN: Could not find the standard library directory! The Python 'home'
directory was set to 'foo', is this correct?
Error occurred computing Python error message.
$build/gdb/gdb: warning:
Could not load the Python gdb module from
`$build/gdb/data-directory/python'.
Limited Python support is available from the _gdb module.
Suggest passing --data-directory=/path/to/gdb/data-directory.
(gdb) set height 0
(gdb) set width 0
(gdb) dir
Reinitialize source path to empty? (y or n) y
Source directories searched: $cdir:$cwd
(gdb) dir $src/gdb/testsuite/gdb.python
Source directories searched:
$src/gdb/testsuite/gdb.python:$cdir:$cwd
(gdb) python print (1)
1
(gdb) FAIL: $exp: gdb-command<python print (1)>
quit
Exception ignored on threading shutdown:
Traceback (most recent call last):
  File "<string>", line 2, in <module>
ModuleNotFoundError: No module named 'importlib'
PASS: gdb.python/py-failed-init.exp: quit
...

The ModuleNotFoundError reported after quit originates from
gdbpy_initialize_gdb_readline.  I've filed a PR about this [1].

The test-case tries to break python:
...
save_vars { env(PYTHONHOME) } {
    setenv PYTHONHOME foo
    clean_restart
}
...
enough to get it to this point:
...
gdb_test "python print (1)" \
    "Python not initialized"
...
but apparently, that doesn't work anymore in this python version:
...
$ python --version
Python 3.15.0b4
...

Update the test-case by simply accepting the output.

[1] https://sourceware.org/bugzilla/show_bug.cgi?id=34485
---
 gdb/testsuite/gdb.python/py-failed-init.exp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.python/py-failed-init.exp b/gdb/testsuite/gdb.python/py-failed-init.exp
index 622743d8d9b..64583df6a96 100644
--- a/gdb/testsuite/gdb.python/py-failed-init.exp
+++ b/gdb/testsuite/gdb.python/py-failed-init.exp
@@ -22,7 +22,7 @@ save_vars { env(PYTHONHOME) } {
 }
 
 gdb_test "python print (1)" \
-    "Python not initialized"
+    "(Python not initialized|1)"
 
 gdb_test_multiple "quit" "" {
     eof {

base-commit: b7da195b94b423e5cfd27a14c636ffe9f7380cdd
-- 
2.51.0


             reply	other threads:[~2026-08-05 13:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-05 13:36 Tom de Vries [this message]
2026-08-19  6:21 ` 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=20260805133639.1532690-1-tdevries@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.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