[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <89d6529f-1849-ce36-bd33-b65f2252214c@linux.vnet.ibm.com>
Date: Thu, 17 Jan 2019 15:18:16 +0530
From: seeteena <s1seetee@...ux.vnet.ibm.com>
To: Jonathan Corbet <corbet@....net>
Cc: peterz@...radead.org, mingo@...hat.com, acme@...nel.org,
alexander.shishkin@...ux.intel.com, jolsa@...hat.com,
namhyung@...nel.org, linux-kernel@...r.kernel.org,
ravi.bangoria@...ux.ibm.com
Subject: Re: [PATCH] perf scripts python: Add Python 3 support to
mem-phys-addr.py
I have added
On 01/16/2019 10:02 PM, Jonathan Corbet wrote:
> On Wed, 16 Jan 2019 21:53:36 +0530
> Seeteena Thoufeek <s1seetee@...ux.vnet.ibm.com> wrote:
>
>> Support both Python 2 and Python 3 in mem-phys-addr.py. ``print`` is now a
>> function rather than a statement. This should have no functional change.
>>
>> Fix lambda syntax error.
> So, I just picked one of these at random....
>
>> Signed-off-by: Seeteena Thoufeek <s1seetee@...ux.vnet.ibm.com>
>> Reviewed-by: Ravi Bangoria <ravi.bangoria@...ux.ibm.com>
>> ---
>> tools/perf/scripts/python/mem-phys-addr.py | 12 ++++++------
>> 1 file changed, 6 insertions(+), 6 deletions(-)
>>
>> diff --git a/tools/perf/scripts/python/mem-phys-addr.py b/tools/perf/scripts/python/mem-phys-addr.py
>> index ebee2c5..52fe9bd 100644
>> --- a/tools/perf/scripts/python/mem-phys-addr.py
>> +++ b/tools/perf/scripts/python/mem-phys-addr.py
>> @@ -38,14 +38,14 @@ def parse_iomem():
>> pmem.append(long(m[1], 16))
>>
>> def print_memory_type():
>> - print "Event: %s" % (event_name)
>> - print "%-40s %10s %10s\n" % ("Memory type", "count", "percentage"),
>> - print "%-40s %10s %10s\n" % ("----------------------------------------", \
>> - "-----------", "-----------"),
>> + print("Event: %s" % (event_name))
>> + print("%-40s %10s %10s\n" % ("Memory type", "count", "percentage")),
>> + print("%-40s %10s %10s\n" % ("----------------------------------------", \
>> + "-----------", "-----------")),
> You have not added "from __future__ import print_function", so you're
> relying on a Python 2 parsing oddity to make this work. If anybody ever
> adds a second parameter, things will break. I think that if you really
> want to support both versions (which seems like the right goal) you should
> add the import and do it properly.
>
> Thanks,
>
> jon
>
Thanks Jonathan. I have added "from __future__ import print_function"
for all the scripts.
Powered by blists - more mailing lists