Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2690417pxj; Mon, 31 May 2021 08:20:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw80jlLtSza0rU6EMTH9H5lwBPK78MVyyEoYElNvWmTeQs+7rh89RrIUKpPIpGqvwEO+2eU X-Received: by 2002:a05:6402:54f:: with SMTP id i15mr4084398edx.339.1622474409755; Mon, 31 May 2021 08:20:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622474409; cv=none; d=google.com; s=arc-20160816; b=e0VHxztvjaP9xmYCwynGesl/57h3HqRz0VPpenWaFbQlhwJV6wcEv9p4qwOfn9EcnH CFZEErfZ2RIJZyf9c5m2oZ+nd+CuFjoec5q6Nry+Y+t7c34iqLLjRLTqSpTcPW9tf7f/ vpVCtc2hE+bPTpCuq58gRN4vqBud1Ot+p+lOAv98rV4FYQln5cVqkU+xn4x3FCHt5Duz WHqdP1QNBH8g0ZCh54fvkz9VOrs2BhSAXTLSh7su64W+V9qbceLp8upLx0CbULB1rbgz fxJXrI9VO/L5+pU2uF3aBecMRVnpwTS0Oftc/d0CowNdD3Qb4q8rGzMgI7yUsjByecJ3 zhJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=A7KfgM0r5KCbesBC1b/5pZ2VwIJCcRu9mvLOKWZNixY=; b=FTw+jtMzodfrol0m4UAzaxk/XXtgkEOhuA2qS9ebIP3TdA/h7ttG0j0tg2alOGod3f JY3Evn6hUzkIO2s7G719wu4DKTych0Y38I5UxrwE2E+rn/UfjbgGpC6arbzhD2EqpqXY ihEKHUqeLZExtKbX1WDDCU4dQhiMQkuZOnjkbArE8LSaPAmbkqbm2lTT0OVmkMF+xzVx cMU88RRuensUhj9QzqysqR1kR9qQQXt5DLAz7pKr2InsQnUBHe0ge24IbMzkE5cCVGFy qAF/LdRPWtpn4rWRmGoDMKG9kQ1zN6cUZQSgL0hwZ7t7NSX4BT6pQpvogxSX+iEndy90 7CFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mWPNUIY+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r9si12590769ejr.730.2021.05.31.08.19.47; Mon, 31 May 2021 08:20:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mWPNUIY+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233500AbhEaPRv (ORCPT + 99 others); Mon, 31 May 2021 11:17:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:43696 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233102AbhEaOOH (ORCPT ); Mon, 31 May 2021 10:14:07 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0E1A261997; Mon, 31 May 2021 13:42:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622468537; bh=6zMg2Uwm/5KXUwjM/b5LE+GC0zql9G7//5mQH1dEFmU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mWPNUIY++yVvhjE1nnS3udSZ9FdFAyxP3NKXDt5UsSFNG6bTLUpVeChYH+Q2PoQY1 pKJO4G9jb0gGadpdzLlfcdJe72wuk56GxA9CJhDJHqeW2NptnP4XbKKERWmTQB4Iu0 V+GXbhaN10ePcWAmKfGQa0oxILvwJAytlLoC3Ppg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Adrian Hunter , Jiri Olsa , Arnaldo Carvalho de Melo Subject: [PATCH 5.4 010/177] perf scripts python: exported-sql-viewer.py: Fix Array TypeError Date: Mon, 31 May 2021 15:12:47 +0200 Message-Id: <20210531130648.259354482@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130647.887605866@linuxfoundation.org> References: <20210531130647.887605866@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Adrian Hunter commit fd931b2e234a7cc451a7bbb1965d6ce623189158 upstream. The 'Array' class is present in more than one python standard library. In some versions of Python 3, the following error occurs: Traceback (most recent call last): File "tools/perf/scripts/python/exported-sql-viewer.py", line 4702, in reports_menu.addAction(CreateAction(label, "Create a new window displaying branch events", lambda a=None,x=dbid: self.NewBranchView(x), self)) File "tools/perf/scripts/python/exported-sql-viewer.py", line 4727, in NewBranchView BranchWindow(self.glb, event_id, ReportVars(), self) File "tools/perf/scripts/python/exported-sql-viewer.py", line 3208, in __init__ self.model = LookupCreateModel(model_name, lambda: BranchModel(glb, event_id, report_vars.where_clause)) File "tools/perf/scripts/python/exported-sql-viewer.py", line 343, in LookupCreateModel model = create_fn() File "tools/perf/scripts/python/exported-sql-viewer.py", line 3208, in self.model = LookupCreateModel(model_name, lambda: BranchModel(glb, event_id, report_vars.where_clause)) File "tools/perf/scripts/python/exported-sql-viewer.py", line 3124, in __init__ self.fetcher = SQLFetcher(glb, sql, prep, self.AddSample) File "tools/perf/scripts/python/exported-sql-viewer.py", line 2658, in __init__ self.buffer = Array(c_char, self.buffer_size, lock=False) TypeError: abstract class This apparently happens because Python can be inconsistent about which class of the name 'Array' gets imported. Fix by importing explicitly by name so that only the desired 'Array' gets imported. Fixes: 8392b74b575c3 ("perf scripts python: exported-sql-viewer.py: Add ability to display all the database tables") Signed-off-by: Adrian Hunter Cc: Jiri Olsa Cc: stable@vger.kernel.org Link: http://lore.kernel.org/lkml/20210521092053.25683-3-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Greg Kroah-Hartman --- tools/perf/scripts/python/exported-sql-viewer.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/tools/perf/scripts/python/exported-sql-viewer.py +++ b/tools/perf/scripts/python/exported-sql-viewer.py @@ -122,8 +122,9 @@ if pyside_version_1: from PySide.QtGui import * from PySide.QtSql import * -from decimal import * -from ctypes import * +from decimal import Decimal, ROUND_HALF_UP +from ctypes import CDLL, Structure, create_string_buffer, addressof, sizeof, \ + c_void_p, c_bool, c_byte, c_char, c_int, c_uint, c_longlong, c_ulonglong from multiprocessing import Process, Array, Value, Event # xrange is range in Python3