lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190116093233.4873b784@lwn.net>
Date:   Wed, 16 Jan 2019 09:32:33 -0700
From:   Jonathan Corbet <corbet@....net>
To:     Seeteena Thoufeek <s1seetee@...ux.vnet.ibm.com>
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

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ