mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-05 15:30:14 +01:00
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 <bochecha@daitauha.fr> Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
This commit is contained in:
parent
e1b88aee68
commit
ba1ebf2ee1
2 changed files with 2 additions and 2 deletions
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue