Re: [PATCH 3/6] tools: perf: tools: perf: exported-sql-viewer: drop support for Python 2

From: Mauro Carvalho Chehab
Date: Tue Feb 11 2025 - 01:59:54 EST


Em Thu, 30 Jan 2025 09:00:26 +0200
Adrian Hunter <adrian.hunter@xxxxxxxxx> escreveu:

> On 29/01/25 19:39, Mauro Carvalho Chehab wrote:
> > As stated at process/changes.rsy doc, the current minimal Python
> > version is 3.x, so drop support for EOL python 2.x.
> >
> > Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx>
> > ---
> > tools/perf/scripts/python/exported-sql-viewer.py | 5 ++---
> > 1 file changed, 2 insertions(+), 3 deletions(-)
> >
> > diff --git a/tools/perf/scripts/python/exported-sql-viewer.py b/tools/perf/scripts/python/exported-sql-viewer.py
> > index 121cf61ba1b3..b096592fd35f 100755
> > --- a/tools/perf/scripts/python/exported-sql-viewer.py
> > +++ b/tools/perf/scripts/python/exported-sql-viewer.py
> > @@ -3939,9 +3939,8 @@ def CopyTreeCellsToClipboard(view, as_csv=False, with_hdr=False):
> > indent_str = " " * indent_sz
> >
> > expanded_mark_sz = 2
> > - if sys.version_info[0] == 3:
> > - expanded_mark = "\u25BC "
> > - not_expanded_mark = "\u25B6 "
> > + expanded_mark = "\u25BC "
> > + not_expanded_mark = "\u25B6 "
>
> You removed the 'if' but left the 'else'.
>
> The white is messed up.
>
> So presumably not tested at all:
>
> python3 tools/perf/scripts/python/exported-sql-viewer.py
> File "/home/user/git/review2/tools/perf/scripts/python/exported-sql-viewer.py", line 3942
> expanded_mark = "\u25BC "
> ^
> IndentationError: unindent does not match any outer indentation level
>
> Posting untested patches, especially tidy-ups,
> should really be discouraged.
>
> There are many other obvious python2 things in this
> file that have not been addressed. When asked, AI
> listed 10 things.

You're right. Btw my main goal was just to make vermin to detect the
minimal version of this script.

I tried to run this script on Fedora 41, installing PySide with
pip there (*):

$ pip install --user PySide2
...
$ perf record ls
...
$ perf script -s tools/perf/scripts/python/export-to-sqlite.py pt_example branches calls
Segmentation fault (core dumped)


but it gives me segmentation fault on a required library:

Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x00007fcab2e0d1ec in SbkObject_TypeF () from ~/.local/lib/python3.13/site-packages/shiboken2/libshiboken2.abi3.so.5.13

(*) Fedora 41 doesn't have pyside2 packages anymore.

Thanks,
Mauro