[Mesa-dev] [PATCH 24/26] python: Use the unicode_escape codec
Mathieu Bridon
bochecha at daitauha.fr
Thu Jul 5 13:17:55 UTC 2018
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
More information about the mesa-dev
mailing list