On Tue, Aug 19, 2025 at 6:24 AM Peter Maydell <peter.mayd...@linaro.org> wrote: > > Some of our Python scripts still include the line > from __future__ import print_function > > which is intended to allow a Python 2 to handle the Python 3 print() > syntax. This particular part of the future arrived many years ago, > and our minimum Python version is 3.9, so we don't need to keep > this line around. > > NB: the scripts in tests/tcg/*/gdbstub/ are run with whatever Python > gdb was built against, but we can safely assume that that was a > Python 3 because our supported distros are all on Python 3. In any > case these are only run as part of "make check-tcg", not by > end-users. > > Commit created with: > > sed -i -e '/import print_function/d' $(git grep -l 'from __future__') > > Signed-off-by: Peter Maydell <peter.mayd...@linaro.org>
Reviewed-by: John Snow <js...@redhat.com> > --- > scripts/userfaultfd-wrlat.py | 1 - > tests/guest-debug/test_gdbstub.py | 1 - > tests/tcg/aarch64/gdbstub/test-mte.py | 1 - > tests/tcg/aarch64/gdbstub/test-sve-ioctl.py | 1 - > tests/tcg/aarch64/gdbstub/test-sve.py | 1 - > tests/tcg/multiarch/gdbstub/interrupt.py | 1 - > tests/tcg/multiarch/gdbstub/memory.py | 1 - > tests/tcg/multiarch/gdbstub/sha1.py | 1 - > tests/tcg/multiarch/gdbstub/test-proc-mappings.py | 1 - > tests/tcg/multiarch/gdbstub/test-qxfer-auxv-read.py | 1 - > tests/tcg/multiarch/gdbstub/test-qxfer-siginfo-read.py | 1 - > tests/tcg/multiarch/gdbstub/test-thread-breakpoint.py | 1 - > tests/tcg/s390x/gdbstub/test-signals-s390x.py | 1 - > tests/tcg/s390x/gdbstub/test-svc.py | 1 - > 14 files changed, 14 deletions(-) > > diff --git a/scripts/userfaultfd-wrlat.py b/scripts/userfaultfd-wrlat.py > index 0684be4e044..a61a9abbfcb 100755 > --- a/scripts/userfaultfd-wrlat.py > +++ b/scripts/userfaultfd-wrlat.py > @@ -17,7 +17,6 @@ > # This work is licensed under the terms of the GNU GPL, version 2 or > # later. See the COPYING file in the top-level directory. > > -from __future__ import print_function > from bcc import BPF > from ctypes import c_ushort, c_int, c_ulonglong > from time import sleep > diff --git a/tests/guest-debug/test_gdbstub.py > b/tests/guest-debug/test_gdbstub.py > index 4f08089e6a9..e017ccb55d7 100644 > --- a/tests/guest-debug/test_gdbstub.py > +++ b/tests/guest-debug/test_gdbstub.py > @@ -1,7 +1,6 @@ > """Helper functions for gdbstub testing > > """ > -from __future__ import print_function > import argparse > import gdb > import os > diff --git a/tests/tcg/aarch64/gdbstub/test-mte.py > b/tests/tcg/aarch64/gdbstub/test-mte.py > index 9ad98e7a54c..f4a7d7b4465 100644 > --- a/tests/tcg/aarch64/gdbstub/test-mte.py > +++ b/tests/tcg/aarch64/gdbstub/test-mte.py > @@ -1,4 +1,3 @@ > -from __future__ import print_function > # > # Test GDB memory-tag commands that exercise the stubs for the > qIsAddressTagged, > # qMemTag, and QMemTag packets, which are used for manipulating allocation > tags. > diff --git a/tests/tcg/aarch64/gdbstub/test-sve-ioctl.py > b/tests/tcg/aarch64/gdbstub/test-sve-ioctl.py > index a78a3a2514d..2c5c2180319 100644 > --- a/tests/tcg/aarch64/gdbstub/test-sve-ioctl.py > +++ b/tests/tcg/aarch64/gdbstub/test-sve-ioctl.py > @@ -1,4 +1,3 @@ > -from __future__ import print_function > # > # Test the SVE ZReg reports the right amount of data. It uses the > # sve-ioctl test and examines the register data each time the > diff --git a/tests/tcg/aarch64/gdbstub/test-sve.py > b/tests/tcg/aarch64/gdbstub/test-sve.py > index 84cdcd4a32e..7b0489a622b 100644 > --- a/tests/tcg/aarch64/gdbstub/test-sve.py > +++ b/tests/tcg/aarch64/gdbstub/test-sve.py > @@ -1,4 +1,3 @@ > -from __future__ import print_function > # > # Test the SVE registers are visible and changeable via gdbstub > # > diff --git a/tests/tcg/multiarch/gdbstub/interrupt.py > b/tests/tcg/multiarch/gdbstub/interrupt.py > index 2d5654d1540..4eccdb41b97 100644 > --- a/tests/tcg/multiarch/gdbstub/interrupt.py > +++ b/tests/tcg/multiarch/gdbstub/interrupt.py > @@ -1,4 +1,3 @@ > -from __future__ import print_function > # > # Test some of the system debug features with the multiarch memory > # test. It is a port of the original vmlinux focused test case but > diff --git a/tests/tcg/multiarch/gdbstub/memory.py > b/tests/tcg/multiarch/gdbstub/memory.py > index 532b92e7fb3..76d75e52512 100644 > --- a/tests/tcg/multiarch/gdbstub/memory.py > +++ b/tests/tcg/multiarch/gdbstub/memory.py > @@ -1,4 +1,3 @@ > -from __future__ import print_function > # > # Test some of the system debug features with the multiarch memory > # test. It is a port of the original vmlinux focused test case but > diff --git a/tests/tcg/multiarch/gdbstub/sha1.py > b/tests/tcg/multiarch/gdbstub/sha1.py > index 1ce711a402c..3403b82fd4a 100644 > --- a/tests/tcg/multiarch/gdbstub/sha1.py > +++ b/tests/tcg/multiarch/gdbstub/sha1.py > @@ -1,4 +1,3 @@ > -from __future__ import print_function > # > # A very simple smoke test for debugging the SHA1 userspace test on > # each target. > diff --git a/tests/tcg/multiarch/gdbstub/test-proc-mappings.py > b/tests/tcg/multiarch/gdbstub/test-proc-mappings.py > index 6eb6ebf7b17..796dca75f0c 100644 > --- a/tests/tcg/multiarch/gdbstub/test-proc-mappings.py > +++ b/tests/tcg/multiarch/gdbstub/test-proc-mappings.py > @@ -1,7 +1,6 @@ > """Test that gdbstub has access to proc mappings. > > This runs as a sourced script (via -x, via run-test.py).""" > -from __future__ import print_function > import gdb > from test_gdbstub import gdb_exit, main, report > > diff --git a/tests/tcg/multiarch/gdbstub/test-qxfer-auxv-read.py > b/tests/tcg/multiarch/gdbstub/test-qxfer-auxv-read.py > index 00c26ab4a95..fa36c943d66 100644 > --- a/tests/tcg/multiarch/gdbstub/test-qxfer-auxv-read.py > +++ b/tests/tcg/multiarch/gdbstub/test-qxfer-auxv-read.py > @@ -1,4 +1,3 @@ > -from __future__ import print_function > # > # Test auxiliary vector is loaded via gdbstub > # > diff --git a/tests/tcg/multiarch/gdbstub/test-qxfer-siginfo-read.py > b/tests/tcg/multiarch/gdbstub/test-qxfer-siginfo-read.py > index 862596b07a7..b18fa1234fb 100644 > --- a/tests/tcg/multiarch/gdbstub/test-qxfer-siginfo-read.py > +++ b/tests/tcg/multiarch/gdbstub/test-qxfer-siginfo-read.py > @@ -1,4 +1,3 @@ > -from __future__ import print_function > # > # Test gdbstub Xfer:siginfo:read stub. > # > diff --git a/tests/tcg/multiarch/gdbstub/test-thread-breakpoint.py > b/tests/tcg/multiarch/gdbstub/test-thread-breakpoint.py > index 4d6b6b9fbe7..49cbc3548f6 100644 > --- a/tests/tcg/multiarch/gdbstub/test-thread-breakpoint.py > +++ b/tests/tcg/multiarch/gdbstub/test-thread-breakpoint.py > @@ -1,4 +1,3 @@ > -from __future__ import print_function > # > # Test auxiliary vector is loaded via gdbstub > # > diff --git a/tests/tcg/s390x/gdbstub/test-signals-s390x.py > b/tests/tcg/s390x/gdbstub/test-signals-s390x.py > index b6b7b39fc46..398ad534ebf 100644 > --- a/tests/tcg/s390x/gdbstub/test-signals-s390x.py > +++ b/tests/tcg/s390x/gdbstub/test-signals-s390x.py > @@ -1,4 +1,3 @@ > -from __future__ import print_function > > # > # Test that signals and debugging mix well together on s390x. > diff --git a/tests/tcg/s390x/gdbstub/test-svc.py > b/tests/tcg/s390x/gdbstub/test-svc.py > index 17210b4e020..29a0aa0ede4 100644 > --- a/tests/tcg/s390x/gdbstub/test-svc.py > +++ b/tests/tcg/s390x/gdbstub/test-svc.py > @@ -1,7 +1,6 @@ > """Test single-stepping SVC. > > This runs as a sourced script (via -x, via run-test.py).""" > -from __future__ import print_function > import gdb > from test_gdbstub import main, report > > -- > 2.43.0 >