diff options
author | Mathieu Bridon <[email protected]> | 2018-07-05 15:17:46 +0200 |
---|---|---|
committer | Dylan Baker <[email protected]> | 2018-08-07 13:28:35 -0700 |
commit | ba1ebf2ee12ef5cb97a450e7d39f577c671d55e4 (patch) | |
tree | 4f246583a06584a7047c09f4ad61b960e1d93b8d /src/compiler | |
parent | e1b88aee680bbdadd283b4a26db74672bb130df5 (diff) |
python: Specify the template output encoding
We're trying to write a unicode string (i.e decoded) to a file opened
in binary (i.e encoded) mode.
In Python 2 this works, because of the automatic conversion between
byte and unicode strings.
In Python 3 this fails though, as no automatic conversion is attempted.
This change makes the scripts compatible with both versions of Python.
Signed-off-by: Mathieu Bridon <[email protected]>
Reviewed-by: Dylan Baker <[email protected]>
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/nir/nir_intrinsics_c.py | 2 | ||||
-rw-r--r-- | src/compiler/nir/nir_intrinsics_h.py | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/compiler/nir/nir_intrinsics_c.py b/src/compiler/nir/nir_intrinsics_c.py index 98af67c38ae..ac45b94d496 100644 --- a/src/compiler/nir/nir_intrinsics_c.py +++ b/src/compiler/nir/nir_intrinsics_c.py @@ -64,7 +64,7 @@ def main(): path = os.path.join(args.outdir, 'nir_intrinsics.c') with open(path, 'wb') as f: - f.write(Template(template).render(INTR_OPCODES=INTR_OPCODES)) + f.write(Template(template, output_encoding='utf-8').render(INTR_OPCODES=INTR_OPCODES)) if __name__ == '__main__': main() diff --git a/src/compiler/nir/nir_intrinsics_h.py b/src/compiler/nir/nir_intrinsics_h.py index 8a4f0d501e6..8abc6a8626d 100644 --- a/src/compiler/nir/nir_intrinsics_h.py +++ b/src/compiler/nir/nir_intrinsics_h.py @@ -53,7 +53,7 @@ def main(): path = os.path.join(args.outdir, 'nir_intrinsics.h') with open(path, 'wb') as f: - f.write(Template(template).render(INTR_OPCODES=INTR_OPCODES)) + f.write(Template(template, output_encoding='utf-8').render(INTR_OPCODES=INTR_OPCODES)) if __name__ == '__main__': main() |