Quoting Stefan Dirsch (2018-03-02 05:02:10)
> On Fri, Mar 02, 2018 at 01:39:40PM +0100, Gustaw Smolarczyk wrote:
> > 2018-03-02 12:59 GMT+01:00 Stefan Dirsch <sndir...@suse.de>:
> > 
> >     On Fri, Mar 02, 2018 at 11:47:57AM +0000, Eric Engestrom wrote:
> >     > On Friday, 2018-03-02 12:25:11 +0100, Stefan Dirsch wrote:
> >     > > On Fri, Mar 02, 2018 at 11:03:53AM +0000, Eric Engestrom wrote:
> >     > > > On Friday, 2018-03-02 11:41:00 +0100, Stefan Dirsch wrote:
> >     > > > > Patch by "Tomas Chvatal" <tchva...@suse.com> with modifications
> >     > > > > by "Michal Srb" <m...@suse.com> to not break python 2.
> >     > > > >
> >     > > > > https://bugzilla.suse.com/show_bug.cgi?id=1082303
> >     > > > >
> >     > > > > v2:
> >     > > > > - no longer try to encode a unicode
> >     > > > > - make use of 'from __future__ import print_function', so 
> > semantics
> >     > > > >   of print statements in python2 are closer to print functions 
> > in
> >     python3
> >     > > > >
> >     > > > > https://lists.freedesktop.org/archives/mesa-dev/2018-February/
> >     187056.html
> >     > > > >
> >     > > > > Signed-off-by: Stefan Dirsch <sndir...@suse.de>
> >     > > > > Reviewed-by: Tomas Chvatal <tchva...@suse.com>
> >     > > > > ---
> >     > > > >  src/gallium/drivers/r600/egd_tables.py | 53
> >     +++++++++++++++++-----------------
> >     > > > >  1 file changed, 27 insertions(+), 26 deletions(-)
> >     > > > >
> >     > > > > diff --git a/src/gallium/drivers/r600/egd_tables.py 
> > b/src/gallium/
> >     drivers/r600/egd_tables.py
> >     > > > > index d7b78c7fb1..4796456330 100644
> >     > > > > --- a/src/gallium/drivers/r600/egd_tables.py
> >     > > > > +++ b/src/gallium/drivers/r600/egd_tables.py
> >     > > > > @@ -1,3 +1,4 @@
> >     > > > > +from __future__ import print_function
> >     > > > >
> >     > > > >  CopyRight = '''
> >     > > > >  /*
> >     > > > > @@ -60,7 +61,7 @@ class StringTable:
> >     > > > >          """
> >     > > > >          fragments = [
> >     > > > >              '"%s\\0" /* %s */' % (
> >     > > > > -                te[0].encode('string_escape'),
> >     > > > > +                te[0],
> > 
> > 
> > Hi,
> > 
> > I am not an expert in Python 3, but I have found the following answer
> > experimentally.
> > 
> > I think the original version is semi-correct, but the encode() method 
> > returns a
> > bytes object which we need to convert to unicode. I think the following 
> > would
> > be fine:
> > 
> > te[0].encode('unicode_escape').decode('utf-8')
> 
> Looks good. And still the same output with python2 and python3. :-) If Dylan
> and Eric agree I'll send a revised patch.

Adding this should be fine for now. It makes me a little bit nervous because
we're acting on unicode strings in python 3 and byte strings in python 2,
however, It's fine for now.

Reviewed-by: Dylan Baker <dy...@pnwbakers.com>

Attachment: signature.asc
Description: signature

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to