[Mesa-dev] [PATCH 24/26] python: Use the unicode_escape codec

Dylan Baker dylan at pnwbakers.com
Thu Jul 5 16:40:24 UTC 2018


Reviewed-by: Dylan Baker <dylan at pnwbakers.com>

Quoting Mathieu Bridon (2018-07-05 06:17:55)
> Python 2 had string_escape and unicode_escape codecs. Python 3 only has
> the latter. These work the same as far as we're concerned, so let's use
> the future-proof one.
> 
> However, the reste of the code expects unicode strings, so we need to
> decode them again.
> 
> Signed-off-by: Mathieu Bridon <bochecha at daitauha.fr>
> ---
>  src/amd/common/sid_tables.py           | 2 +-
>  src/gallium/drivers/r600/egd_tables.py | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/amd/common/sid_tables.py b/src/amd/common/sid_tables.py
> index 421c2a1335..7b5e626e3e 100644
> --- a/src/amd/common/sid_tables.py
> +++ b/src/amd/common/sid_tables.py
> @@ -65,7 +65,7 @@ class StringTable:
>          """
>          fragments = [
>              '"%s\\0" /* %s */' % (
> -                te[0].encode('string_escape'),
> +                te[0].encode('unicode_escape').decode(),
>                  ', '.join(str(idx) for idx in sorted(te[2]))
>              )
>              for te in self.table
> diff --git a/src/gallium/drivers/r600/egd_tables.py b/src/gallium/drivers/r600/egd_tables.py
> index 7489649ec7..8a60a6229a 100644
> --- a/src/gallium/drivers/r600/egd_tables.py
> +++ b/src/gallium/drivers/r600/egd_tables.py
> @@ -61,7 +61,7 @@ class StringTable:
>          """
>          fragments = [
>              '"%s\\0" /* %s */' % (
> -                te[0].encode('string_escape'),
> +                te[0].encode('unicode_escape').decode(),
>                  ', '.join(str(idx) for idx in te[2])
>              )
>              for te in self.table
> -- 
> 2.17.1
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: signature
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180705/54b6804e/attachment.sig>


More information about the mesa-dev mailing list