]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/testsuite] Avoid generating gdb_leak_detector.cpython-<n>.pyc
authorTom de Vries <tdevries@suse.de>
Mon, 28 Apr 2025 16:03:09 +0000 (18:03 +0200)
committerTom de Vries <tdevries@suse.de>
Mon, 28 Apr 2025 16:03:09 +0000 (18:03 +0200)
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.

gdb/testsuite/gdb.python/py-color-leak.py
gdb/testsuite/gdb.python/py-inferior-leak.py
gdb/testsuite/gdb.python/py-read-memory-leak.py

index 50dc315985d28d588d1afdec7d9a5bc585d90a46..28afd59bfcb470eb6bc59551df7055af9d68b982 100644 (file)
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+import sys
+
+# Avoid generating
+# src/gdb/testsuite/gdb.python/__pycache__/gdb_leak_detector.cpython-<n>.pyc.
+sys.dont_write_bytecode = True
+
 import gdb_leak_detector
 
 
index f76468840b3f872520d2a383973dacccace356c9..bf61668532b20e92230bb3110e05cce0c94a6706 100644 (file)
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+import sys
+
+# Avoid generating
+# src/gdb/testsuite/gdb.python/__pycache__/gdb_leak_detector.cpython-<n>.pyc.
+sys.dont_write_bytecode = True
+
 import re
 
 import gdb_leak_detector
index 71edf47e7dcc658538ec7165f9b24619c77e0ec4..89647cf27858a5707972fa03e0951c6e341b3c8a 100644 (file)
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+import sys
+
+# Avoid generating
+# src/gdb/testsuite/gdb.python/__pycache__/gdb_leak_detector.cpython-<n>.pyc.
+sys.dont_write_bytecode = True
+
 import gdb_leak_detector