`PatchSet' API mismatch causing a total `contrib/mklog.py' failure?

Jonathan Wakely jwakely.gcc@gmail.com
Mon Nov 16 13:06:01 GMT 2020


On Mon, 16 Nov 2020 at 12:49, Maciej W. Rozycki <macro@linux-mips.org> wrote:
>
> On Mon, 16 Nov 2020, Martin Liška wrote:
>
> > >   Let's retry with `ipython' installed now:
> > >
> > > $ git show 2935ff7eb7ac > 1
> > > $ ipython
> > > $ Python 2.7.16 (default, Oct 10 2019, 22:02:15)
> > > Type "copyright", "credits" or "license" for more information.
> >
> > Please no python2, it's dead and buried really deep in the ground :)
>
>  Well, I only followed your instructions as you gave them.  For Python 3
> it's `ipython3' and `ipython' is Python 2 here.  As I say, a standard
> Debian distribution.

ipython is irrelevant to the mklog.py script, which doesn't use it.
It's what Martin was using on the command-line, but is not actually
relevant to the issue at hand.

> > > IPython 5.8.0 -- An enhanced Interactive Python.
> > > ?         -> Introduction and overview of IPython's features.
> > > %quickref -> Quick reference.
> > > help      -> Python's own help system.
> > > object?   -> Details about 'object', use 'object??' for extra details.
> > >
> > > In [1]: from unidiff import PatchSet
> > >
> > > In [2]: PatchSet(open('1'))
> > > Out[2]: <PatchSet: [<PatchedFile: gcc/testsuite/g++.dg/ubsan/pr61272.C>]>
> > >
> > > Same with `ipython3' except for:
> > >
> > > Python 3.7.3 (default, Jul 25 2020, 13:03:44)
> >
> > What tells:
> > unidiff.VERSION
> > ?
>
> In [1]: from unidiff import PatchSet
>
> In [2]: unidiff.VERSION
> ---------------------------------------------------------------------------
> NameError                                 Traceback (most recent call last)
> <ipython-input-3-049af7d22b51> in <module>()
> ----> 1 unidiff.VERSION
>
> NameError: name 'unidiff' is not defined

You only imported unidiff.PatchSet, not unidiff.VERSION. Either import
that, or the whole of unidiff.

Without ipython:

echo 'import unidiff ; print(unidiff.VERSION)' | python3

The contrib/mklog.py script requires Python 3, which doesn't seem
unreasonable in 2020. Its shebang makes that clear:
/usr/bin/env python3


More information about the Gcc mailing list