Mesa (master): python: Use the unicode_escape codec

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Aug 1 13:57:23 UTC 2018


Module: Mesa
Branch: master
Commit: 91939255a7c556a5d85a57fb6a191e0c8cfd29ce
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=91939255a7c556a5d85a57fb6a191e0c8cfd29ce

Author: Mathieu Bridon <bochecha at daitauha.fr>
Date:   Thu Jun  7 12:26:20 2018 +0200

python: Use the unicode_escape codec

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>
Reviewed-by: Dylan Baker <dylan at pnwbakers.com>

---

 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




More information about the mesa-commit mailing list