Re: [PATCH v2] perf scripts python: Add Python 3 support to exported-sql-viewer.py

From: Jonathan Corbet
Date: Sun Jan 20 2019 - 14:29:33 EST


On Fri, 18 Jan 2019 16:45:04 -0800
Tony Jones <tonyj@xxxxxxx> wrote:

> On 1/17/19 1:45 AM, Seeteena Thoufeek wrote:
>
> > +if sys.version_info[0] < 3:
> > + import cPickle
> > +else:
> > + import _pickle as cPickle
>
> Do you really need this?
>
> pickle is already in Python2.

Did you mean in Python3? I would agree that using it is better than
importing the semi-hidden _pickle module.

That said, I'll echo the questions about testing. Pickle works in
Python3, but it is fraught with all kinds of bytes/str and encoding
issues; I've found it sufficiently fragile in practice that I really just
try to avoid it. How have you verified that this script works under both
versions of Python?

Thanks,

jon