lkml.org 
[lkml]   [2020]   [Apr]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] selftests/tpm2: Change exception handling to be Python 3 compatible
On Mon, Apr 13, 2020 at 07:02:20AM +0200, Ezra Buehler wrote:
> Hi Jarkko,
>
> On 12 Apr 2020, at 19:07, Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> wrote:
> >
> > On Sun, Apr 12, 2020 at 05:02:27PM +0200, Ezra Buehler wrote:
> >> Hi Jarkkon,
> >>
> >>> On 12 Apr 2020, at 16:36, Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> wrote:
> >>> + except ProtocolError(e):
> >>
> >> Should this not be
> >>
> >> except ProtocolError as e:
> >
> > Unless there is a functional difference, does it matter?
> >
> > /Jarkko
>
> Well, your patch confuses me a lot. It looks to me like you are passing
> the undefined `e` variable to the constructor.
>
> When I run flake8 on it I get following error (among others):
>
> F821 undefined name 'e'

I don't know what flake8 is.

> What I suggested is the standard syntax:
> https://docs.python.org/3/tutorial/errors.html

It passed the Python 3 interpreter.

> Did you test this? You should get an error as soon as an exception
> occurs.

Yes. Interpreter did not complain. I did not know that the language
is broken that way that you have to exercise the code path to get
a syntax error.

/Jarkko

\
 
 \ /
  Last update: 2020-04-13 20:05    [W:0.085 / U:2.252 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site