Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] [gdb/testsuite] Fix gdb.python/py-failed-init.exp with python 3.15
@ 2026-08-05 13:36 Tom de Vries
  2026-08-19  6:21 ` Tom de Vries
  0 siblings, 1 reply; 2+ messages in thread
From: Tom de Vries @ 2026-08-05 13:36 UTC (permalink / raw)
  To: gdb-patches

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] [gdb/testsuite] Fix gdb.python/py-failed-init.exp with python 3.15
  2026-08-05 13:36 [PATCH] [gdb/testsuite] Fix gdb.python/py-failed-init.exp with python 3.15 Tom de Vries
@ 2026-08-19  6:21 ` Tom de Vries
  0 siblings, 0 replies; 2+ messages in thread
From: Tom de Vries @ 2026-08-19  6:21 UTC (permalink / raw)
  To: gdb-patches

On 8/5/26 3:36 PM, Tom de Vries wrote:
> 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.
I've pushed this.

Thanks,
- Tom

> [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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-08-19  6:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-05 13:36 [PATCH] [gdb/testsuite] Fix gdb.python/py-failed-init.exp with python 3.15 Tom de Vries
2026-08-19  6:21 ` 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