From: Tom de Vries Date: Mon, 28 Apr 2025 16:03:09 +0000 (+0200) Subject: [gdb/testsuite] Avoid generating gdb_leak_detector.cpython-.pyc X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1c32c7150dc955b62e810367d23535643dcb36d5;p=thirdparty%2Fbinutils-gdb.git [gdb/testsuite] Avoid generating gdb_leak_detector.cpython-.pyc After running test-case gdb.python/py-color-leak.exp in a container where I don't have PYTHONDONTWRITEBYTECODE set, I get: ... $ ls src/gdb/testsuite/gdb.python/__pycache__/ gdb_leak_detector.cpython-313.pyc ... Fix this by setting sys.dont_write_bytecode to True in the python scripts importing the module. Tested on x86_64-linux. --- diff --git a/gdb/testsuite/gdb.python/py-color-leak.py b/gdb/testsuite/gdb.python/py-color-leak.py index 50dc315985d..28afd59bfcb 100644 --- a/gdb/testsuite/gdb.python/py-color-leak.py +++ b/gdb/testsuite/gdb.python/py-color-leak.py @@ -13,6 +13,12 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +import sys + +# Avoid generating +# src/gdb/testsuite/gdb.python/__pycache__/gdb_leak_detector.cpython-.pyc. +sys.dont_write_bytecode = True + import gdb_leak_detector diff --git a/gdb/testsuite/gdb.python/py-inferior-leak.py b/gdb/testsuite/gdb.python/py-inferior-leak.py index f76468840b3..bf61668532b 100644 --- a/gdb/testsuite/gdb.python/py-inferior-leak.py +++ b/gdb/testsuite/gdb.python/py-inferior-leak.py @@ -13,6 +13,12 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +import sys + +# Avoid generating +# src/gdb/testsuite/gdb.python/__pycache__/gdb_leak_detector.cpython-.pyc. +sys.dont_write_bytecode = True + import re import gdb_leak_detector diff --git a/gdb/testsuite/gdb.python/py-read-memory-leak.py b/gdb/testsuite/gdb.python/py-read-memory-leak.py index 71edf47e7dc..89647cf2785 100644 --- a/gdb/testsuite/gdb.python/py-read-memory-leak.py +++ b/gdb/testsuite/gdb.python/py-read-memory-leak.py @@ -13,6 +13,12 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +import sys + +# Avoid generating +# src/gdb/testsuite/gdb.python/__pycache__/gdb_leak_detector.cpython-.pyc. +sys.dont_write_bytecode = True + import gdb_leak_detector