Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1616374imm; Fri, 27 Jul 2018 22:43:22 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcV1wD0IwOW7Bf+wNtas2st4EI/tzTmrRQzdVy93PpoAGnJEl6m9tA5HDdJWHNVkNMTSBiS X-Received: by 2002:a63:4e5f:: with SMTP id o31-v6mr8802440pgl.256.1532756602044; Fri, 27 Jul 2018 22:43:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532756602; cv=none; d=google.com; s=arc-20160816; b=jpSwGuZG6sZ1N0r8GoZQ+jc/aiexCIO5eds24r7NsEDtTqR89YKlqnk583Ce40nlNA 0tYsJ+lTpJfdlj7dYSi9a/ScLoN+07CbkfixYtMrz10BQJJzfQvT6blpht03/2NdmjEs oVtX5TGf48r4opBF4Yng1/jOxFNcRePsBmUT/HCyvEvuT/int1EytkaeN87+KfG5C57u TxwUQZ72iSRmZy7HEVUrxl7ETOyn4WkXiTp8nlcasAWyaStKBQ1jXb2wjUb+1jgjjQ9G /AmGiQ23sZ2osVnVTqI0O5go9CXWDyQ9WrL8bGIwLuPrAgQw5d6qngw1bFeGU2wQG4+b 2dwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature:dkim-filter :arc-authentication-results; bh=z8KjIi1Dn85sxSz+TYmmynKB2daBqs+s7c97qFqXNMc=; b=Qi2gB8JvJe0piSh3r/a3JZLdb63BPuUrn85nPygIVd6QfWfigtqcdiaL+hqP5O0aoo 4H7vz/L3lnqNXXHPju6MdAm6LGmbw6bW1N6lbDo3JppWGQkMK4xHxd11E0VM3MJAGlGM 7I5kqDwMMqfMM32d7uHSAJvsoBZf11uegY6FECQmuVCsAR0aKom9b4Nx6AE2DglsYu9s K9AkToNt+pj9grqaPkW9iJmksuKv2XNZzymgNpl1F3hUY9Wl9QmRaof9c3VDMlGbU/qd yCf7YYgQfTyNY+WAMNnrvP2uFB88NzjjuF4AtOzMCkIWDfopGrIFTrRgmPsNXXcfIxqt lvNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=kqdSKvbH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d9-v6si5398308pgg.423.2018.07.27.22.43.08; Fri, 27 Jul 2018 22:43:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=kqdSKvbH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726302AbeG1HHS (ORCPT + 99 others); Sat, 28 Jul 2018 03:07:18 -0400 Received: from conssluserg-03.nifty.com ([210.131.2.82]:31554 "EHLO conssluserg-03.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725835AbeG1HHR (ORCPT ); Sat, 28 Jul 2018 03:07:17 -0400 Received: from mail-ua0-f169.google.com (mail-ua0-f169.google.com [209.85.217.169]) (authenticated) by conssluserg-03.nifty.com with ESMTP id w6S5fwx2005915; Sat, 28 Jul 2018 14:41:59 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-03.nifty.com w6S5fwx2005915 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1532756519; bh=z8KjIi1Dn85sxSz+TYmmynKB2daBqs+s7c97qFqXNMc=; h=In-Reply-To:References:From:Date:Subject:To:Cc:From; b=kqdSKvbH9MsWgAELZm6crTDmBk0ZQLoE63BHv1aZL0h6ADosNnCsJGvTsPjrHMT99 8sbU9Hrg9j5uujs+MmvKH57xsz4m8w/8kMw4r6D8v5J5KvZI7kjO+KiXyX68oi6NW/ QfR0ME/kIohi78QCuHQg+ZCJoLDB+z/d6u2mCsiOZpU9OfQbNZKMB05eagvzfeaxon rBXJXuFMn+A2ucRLRH0uwMnpWPtJd7L2PHby+mJv2O57M7mdxvve9GAccOMiAlBxax Vl7RA/za83OQwZnpzXISwanQBiwKW9Ezc3CdP06SB808qev1eRa4olTgQ6d+qAG+U0 kdv17W+qnMJgg== X-Nifty-SrcIP: [209.85.217.169] Received: by mail-ua0-f169.google.com with SMTP id k25-v6so4707850uao.11; Fri, 27 Jul 2018 22:41:59 -0700 (PDT) X-Gm-Message-State: AOUpUlFzzsnTGDscwagYl5IzGNtxdt8n6jdWDR9INvZ4WMIa6hs2rrAR 8jWZsmVHfKPriUsiUq2dNDoQYESmc8mhvjIUuuA= X-Received: by 2002:ab0:4946:: with SMTP id a6-v6mr6586408uad.82.1532756518229; Fri, 27 Jul 2018 22:41:58 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:ab0:7289:0:0:0:0:0 with HTTP; Fri, 27 Jul 2018 22:41:17 -0700 (PDT) In-Reply-To: References: <20180720193528.1341-1-jcline@redhat.com> From: Masahiro Yamada Date: Sat, 28 Jul 2018 14:41:17 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] scripts: Add Python 3 support to tracing/draw_functrace.py To: Jeremy Cline Cc: Michal Marek , Frederic Weisbecker , Linux Kbuild mailing list , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2018-07-26 0:01 GMT+09:00 Jeremy Cline : > On 07/25/2018 10:39 AM, Masahiro Yamada wrote: >> 2018-07-21 4:35 GMT+09:00 Jeremy Cline : >>> Use the print function. This maintains Python 2 support and should have >>> no functional change. >>> >>> Signed-off-by: Jeremy Cline >>> --- >>> scripts/tracing/draw_functrace.py | 3 ++- >>> 1 file changed, 2 insertions(+), 1 deletion(-) >>> >>> diff --git a/scripts/tracing/draw_functrace.py b/scripts/tracing/draw_functrace.py >>> index db40fa04cd51..7d44e796d362 100755 >>> --- a/scripts/tracing/draw_functrace.py >>> +++ b/scripts/tracing/draw_functrace.py >>> @@ -20,6 +20,7 @@ Usage: >>> $ scripts/draw_functrace.py < raw_trace_func > draw_functrace >>> Then you have your drawn trace in draw_functrace >>> """ >>> +from __future__ import print_function >> >> What do you need this line for? >> >> I have not tested this, >> but I guess print(CallTree.ROOT) will work for Python 2. > > Although "print(CallTree.ROOT)" (as a statement) works in Python 2, > its behavior is different than print (as a function) in Python 3. In > this case, there's no additional arguments being provided so the > behavior will match, but if someone added an argument it would work > differently on Python 2 vs Python 3: > > Python 2.7.15 >>>> print("hello", "world") > ('hello', 'world') > > Python 3.6.6 >>>> print("hello, "world") > File "", line 1 > print("hello, "world") > ^ > SyntaxError: invalid syntax Yes, I know this. > Importing the print_function works on Python 2.6+[0] and changes print > to be a function in Python 2 so it'll behave the same in 2 and 3. Given > that this script doesn't appear to change much it's probably not going > to save anyone from making that mistake, though. Would you prefer a > patch without it? Either will do. If it is tedious to respin, I will pick this up. I saw only one simple print statement in this script, so I wanted to ask you if this had some reason I might be missing. Anyway, we will remove 'from __future__ import print_function' when Python 2 retires. > [0] https://docs.python.org/3/library/__future__.html > > Regards, > Jeremy > >> >> >> >>> >>> import sys, re >>> @@ -123,7 +124,7 @@ def main(): >>> tree = tree.getParent(caller) >>> tree = tree.calls(callee, calltime) >>> >>> - print CallTree.ROOT >>> + print(CallTree.ROOT) >>> >>> if __name__ == "__main__": >>> main() >>> -- >>> 2.17.1 >>> >> >> >> > -- > To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- Best Regards Masahiro Yamada