diff --git a/gdb/testsuite/gdb.python/py-startup-opt.exp b/gdb/testsuite/gdb.python/py-startup-opt.exp index cf2a2cf6768..014aff5725a 100644 --- a/gdb/testsuite/gdb.python/py-startup-opt.exp +++ b/gdb/testsuite/gdb.python/py-startup-opt.exp @@ -78,8 +78,9 @@ proc test_python_settings { exp_state } { # all GDB developers some will test GDB with this environment # variable unset. if { $attr == "dont_write_bytecode" \ - && $exp_state == "off" - && [info exists ::env(PYTHONDONTWRITEBYTECODE)] } { + && $exp_state == "off" \ + && [info exists ::env(PYTHONDONTWRITEBYTECODE)] \ + && $::env(PYTHONDONTWRITEBYTECODE) != "" } { set answer "on" } else { set answer $exp_state