Re: [PATCH] - Adapt to Python-3 print syntax

Tom Tromey
2025-10-15T13:45:34Z

>>>>> "Jeremy" == Jeremy Bryant <jb@jeremybryant.net> writes:

Jeremy> This change adapts doc examples to Python 3 so they work on current
Jeremy> installations.

Jeremy> python.texi uses a mixture of Python 3 and Python 2 print syntax, the
Jeremy> latter having been sunsetted several years ago.

This looks reasonable but:

Jeremy> -(@value{GDBP}) python print 23
Jeremy> +(@value{GDBP}) python print(23)

Here there's no space after the "print" -- which is standard Python
style, so seems fine; but...

Jeremy> -print gdb.string_to_argv ("1 2\ \\\"3 '4 \"5' \"6 '7\"")
Jeremy> +print (gdb.string_to_argv ("1 2\ \\\"3 '4 \"5' \"6 '7\""))

... here there's no space. There were a few like this and I wondered
why the discrepancy.

Tom