Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp898468imm; Wed, 25 Jul 2018 08:02:34 -0700 (PDT) X-Google-Smtp-Source: AAOMgpepB79MPc6vIWyR6pqvKvlB5IVnNHg+iYjouwpfF5vshy9o7UQUZbcOI4WP6q8tXFirsNDV X-Received: by 2002:a63:dc53:: with SMTP id f19-v6mr1037332pgj.56.1532530954771; Wed, 25 Jul 2018 08:02:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532530954; cv=none; d=google.com; s=arc-20160816; b=pKIVspvtyoahohnOsbj9KHAMnR0krSXt8+eFiZSMYgWE5O2GJ5TtjyXNlxdqbLuFsm QFdO9DRT1NDBsv20jJ5Qm9K8rB/u76jg3c4EMz+wzYMWwPzoyMKsyzf718mdecQhmiWh fpgJc7x7gE+LbxLETMYvzm7fRoOFd5kY42EkQf6sQ1iXkA+lPo+Anj6lNaQXHzHUkbIA lpxTJCeMEHpyC9/qBhllMw8slfhV6a2EMkc1yTXNQJV8hNyC1h0uVmrAMHHWIls6PUzq kQmJsLpLWnu1lzgaS/NZcj7VFBh5Qp2jelM3BAx4Np8zG5bOD6VWtYThcZ8lv4uxB2BI WcNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:openpgp:from:references:cc:to:subject :arc-authentication-results; bh=qZi5F5hz5jWJp5maHjZGiMG3J86Ec9jIUqPq+ttQDNU=; b=CfNPXVQwqiW3hXtmeuO2mG7szCeFdJjpFfGAYwm7bNyz6A7uUZyePcLeiUDTJ87PIf hX0sNcIAbamFtm9/TTL5H4xi1rNbK/QsTNTts4+zvhhv/WkqpdKEel6bOriBqtDT/jLn CJT9kFjLPThE+0ET+ASPD2iZRe3/FeYzEDFPznPR3vBvghOqv1sOehcELh+YaYI7nSSa WaEAjt7r060V2Bu5JQ83b5QoBfeUNiyoz7am0lm6FpNqjNPjznROSjBQqQwI79Bt1O5c U62O71MV+7JjYYYhPnPXEHtPiARzydTrNg1uDChoLHJTSl8GkQ+aVkO14gmxQRGCnFu6 EAlw== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x19-v6si14166632pgk.80.2018.07.25.08.02.18; Wed, 25 Jul 2018 08:02:34 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729157AbeGYQNb (ORCPT + 99 others); Wed, 25 Jul 2018 12:13:31 -0400 Received: from mail-qk0-f196.google.com ([209.85.220.196]:47094 "EHLO mail-qk0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729092AbeGYQNb (ORCPT ); Wed, 25 Jul 2018 12:13:31 -0400 Received: by mail-qk0-f196.google.com with SMTP id o2-v6so5071676qkc.13 for ; Wed, 25 Jul 2018 08:01:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=qZi5F5hz5jWJp5maHjZGiMG3J86Ec9jIUqPq+ttQDNU=; b=CN/6LkG8hR5qX6zdWpgZ5u03MTEudCSBzbToY3lWDeZ6h2zvKP25JnR5bz/Hbl0Gfx eP2L5pl2nufraGts3hVNT/boKS5l5HzLWDqsSI4DewbzwGc7zgEttxB4pdRIMuznuusT I/gWbOY+JmMkuj5DyqKErut+buSpTSQHbP+uwqZSDiHVjMAPz9/a77awLJ24LIDcvm2t Dy2xY5IYo//yhWx0ik0m5+N1vDgVqokYmFioIg3Y4qrlIQRQpHJlSTk7y6TVzcdHCkOK FMK5cIbWj3EBI6/mDzHypIGnkA70fTb80vU+GBl7z2qZ5IOUIqrJMtdyb/vBV1IqT5R0 4THg== X-Gm-Message-State: AOUpUlHa3jQs9sxS4y5Wq8dVJCU4GEC6pQWY5mXdkXklIKt/23SZ/yAM w+BwYkafzPvnYGED9rtw6MF9BTzUL/c= X-Received: by 2002:a37:5142:: with SMTP id f63-v6mr19833738qkb.369.1532530884373; Wed, 25 Jul 2018 08:01:24 -0700 (PDT) Received: from laptop.jcline.org (075-177-179-204.res.spectrum.com. [75.177.179.204]) by smtp.gmail.com with ESMTPSA id f64-v6sm17110595qkf.2.2018.07.25.08.01.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Jul 2018 08:01:23 -0700 (PDT) Subject: Re: [PATCH] scripts: Add Python 3 support to tracing/draw_functrace.py To: Masahiro Yamada Cc: Michal Marek , Frederic Weisbecker , Linux Kbuild mailing list , Linux Kernel Mailing List References: <20180720193528.1341-1-jcline@redhat.com> From: Jeremy Cline Openpgp: preference=signencrypt Autocrypt: addr=jcline@redhat.com; keydata= xsFNBFThCPYBEACx9hl05pMfpVKVjm8Yrmd2I3sm9Jw7EIGfn1tmncSnzfveN7UcIjYI23Gw DE11Hf70tMZKXhNmQqDqoftEDwLbTuzBdgJXFZmfEwrcQHGiR5CZ4IQ3U7SF0a701lyYtuNs WndEO8CCaWHUYybiEl1yRZhwyzAA1j/izilD7FckOaEsTM1sFVDs74qWsNGIdJXYQ5dz/iV/ 45wg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GyJ0h8ZTGQi1bD/wMbSCnreanQFYTTgzC 6i/dtsWrd3DvJzaxKdUrSjioP1tK6YLpS7SSc5khYUjVp7xdsu9vCazsLspzBYbQOV02xtI5 CTLwMzh4hYE1/66K899++0v2dP9m9DEKu/R4vqW4axTfWIbR/ygd1bh2a/7NpAT6qiJg8vha Qkf/fVKZ9xM7EDHmfFJscqC6JyYNdYvz8wJ0aa9Z6zvnNUzjAntj62kJV8b8m5diUQDUI8dp r9crk+XxOTNpYid6p8mlNTcX54LTy1eEL7BYG1S3ezcLZC9/78MTdTJbxQMz7/zQXOABfMDy +otLuhEBxi5hl+COIsiRotTOBNPNr1UmV4fQjXz2K6cfgaO/9NilQaEU6zpsMcAOi5lLxlzD GRyPO2a0QQFZ7FmH9dRWw/6mmspQMBNRr5CrQdIBiWDcJGNPl8iX9TqwP62dZgwANT6+FR7K If4axm/gJQMSUCon3eLJhi8b5qZp4vZn7Xj4hCswrO9eExmT9IjpRVcHLYti36m99WRvItDy dVvrvIQi5qah3PrQjtwSJ61ExSZTOpBQGC60yQf+GG0TISIeeXX8CK2e1PIDt7/l+d0onCmU /98IQsNgR/9sifmdPeh3nKsxe2vsa3HNeElQU2ko6ZHMrE0gSyel5vaqRLQQwekBx1mr/7Ll X/87hZ4pdW/aOXUAgQ== Message-ID: Date: Wed, 25 Jul 2018 11:01:21 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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? [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 >> > > >