[Mesa-dev] [PATCH 1/3] intel/genxml: Make assert in gen_pack_header print a message.

Jason Ekstrand jason at jlekstrand.net
Mon May 7 21:16:28 UTC 2018


Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>

On Mon, May 7, 2018 at 1:51 PM, Caio Marcelo de Oliveira Filho <
caio.oliveira at intel.com> wrote:

> Series is
>
> Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira at intel.com>
>
>
> On Mon, May 07, 2018 at 01:40:44PM -0700, Kenneth Graunke wrote:
> > Python's assert can take both a condition and a string, which will cause
> > it to print the string if the assertion trips.  (You can't use parens as
> > that creates a tuple.)  Doing "condition and string" works in C, but
> > doesn't have the desired effect in Python.
> > ---
> >  src/intel/genxml/gen_pack_header.py | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/src/intel/genxml/gen_pack_header.py
> b/src/intel/genxml/gen_pack_header.py
> > index 6a4c8033a70..4bce425d12e 100644
> > --- a/src/intel/genxml/gen_pack_header.py
> > +++ b/src/intel/genxml/gen_pack_header.py
> > @@ -220,7 +220,7 @@ def num_from_str(num_str):
> >      if num_str.lower().startswith('0x'):
> >          return int(num_str, base=16)
> >      else:
> > -        assert(not num_str.startswith('0') and 'octals numbers not
> allowed')
> > +        assert not num_str.startswith('0'), 'octals numbers not allowed'
> >          return int(num_str)
> >
> >  class Field(object):
> > --
> > 2.17.0
> >
> > _______________________________________________
> > mesa-dev mailing list
> > mesa-dev at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/mesa-dev
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180507/0aa52fe3/attachment.html>


More information about the mesa-dev mailing list