diff options
author | Tom de Vries <tdevries@suse.de> | 2024-12-03 22:54:23 +0100 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2024-12-03 22:54:23 +0100 |
commit | 922ab963e1c48c364b7f6363cb8e19f8a7175a20 (patch) | |
tree | e5600a16d4131bd5a2950bb9dc5eb5692253d32b /gdb/testsuite/gdb.python | |
parent | 1dc13c7e9f47718b51d8206e0b7cc8b244271ce4 (diff) | |
download | gdb-922ab963e1c48c364b7f6363cb8e19f8a7175a20.zip gdb-922ab963e1c48c364b7f6363cb8e19f8a7175a20.tar.gz gdb-922ab963e1c48c364b7f6363cb8e19f8a7175a20.tar.bz2 |
[gdb/python] Handle empty PYTHONDONTWRITEBYTECODE
When using PYTHONDONTWRITEBYTECODE with an empty string we get:
...
$ PYTHONDONTWRITEBYTECODE= gdb -q -batch -ex "show python dont-write-bytecode"
Python's dont-write-bytecode setting is auto (currently on).
...
This is incorrect, it should be off.
The actual setting is correct, that was already fixed in commit 24d2cbc42cc
("set/show python dont-write-bytecode fixes"), in function
python_write_bytecode.
Fix this by:
- factoring out new function env_python_dont_write_bytecode out of
python_write_bytecode, and
- using it in show_python_dont_write_bytecode.
Tested on x86_64-linux, using test-case gdb.python/py-startup-opt.exp and:
- PYTHONDONTWRITEBYTECODE=
- PYTHONDONTWRITEBYTECODE=1
- unset PYTHONDONTWRITEBYTECODE
Approved-By: Tom Tromey <tom@tromey.com>
PR python/32389
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32389
Diffstat (limited to 'gdb/testsuite/gdb.python')
-rw-r--r-- | gdb/testsuite/gdb.python/py-startup-opt.exp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.python/py-startup-opt.exp b/gdb/testsuite/gdb.python/py-startup-opt.exp index 014aff5..df35a37 100644 --- a/gdb/testsuite/gdb.python/py-startup-opt.exp +++ b/gdb/testsuite/gdb.python/py-startup-opt.exp @@ -93,6 +93,14 @@ proc test_python_settings { exp_state } { "else:" "" \ " print (\"${attr} is off\")" "" \ "end" "${attr} is ${answer}" + + if { $attr == "dont_write_bytecode" && $exp_state == "off" } { + set setting dont-write-bytecode + set show_setting \ + "Python's $setting setting is auto (currently $answer)." + gdb_test "show python $setting" \ + [string_to_regexp $show_setting] + } } gdb_exit |