mojo: Fix writing to file on Python 3
Doing the encode() when writing the file avoids needing to add it to all callsites. Removed where it was previously added. There should be no behavioural changes. Traceback (most recent call last): File "../../mojo/public/tools/bindings/mojom_bindings_generator.py", line 556, in <module> sys.exit(main()) File "../../mojo/public/tools/bindings/mojom_bindings_generator.py", line 551, in main return args.func(args, remaining_args) File "../../mojo/public/tools/bindings/mojom_bindings_generator.py", line 267, in _Generate processor._GenerateModule(args, remaining_args, generator_modules, File "../../mojo/public/tools/bindings/mojom_bindings_generator.py", line 238, in _GenerateModule generator.GenerateFiles(filtered_args) File "C:\Google\chromium\src\mojo\public\tools\bindings\generators\mojom_cpp_generator.py", line 464, in GenerateFiles self.WriteWithComment(self._GenerateModuleSharedHeader(), File "C:\Google\chromium\src\mojo\public\tools\bindings\pylib\mojom\generate\generator.py", line 234, in WriteWithComment self.Write(contents, filename) File "C:\Google\chromium\src\mojo\public\tools\bindings\pylib\mojom\generate\generator.py", line 226, in Write WriteFile(contents, full_path) File "C:\Google\chromium\src\mojo\public\tools\bindings\pylib\mojom\generate\generator.py", line 115, in WriteFile f.write(contents) TypeError: a bytes-like object is required, not 'str' Bug: 941669 Change-Id: I0669c2021e71077f28f156a3e055e5746da246c1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1994882 Auto-Submit: Raul Tambre <raul@tambre.ee> Reviewed-by:Ken Rockot <rockot@google.com> Commit-Queue: Raul Tambre <raul@tambre.ee> Cr-Commit-Position: refs/heads/master@{#732472}
Showing
Please register or sign in to comment