MyDeveloperDay created this revision.
MyDeveloperDay added reviewers: krasimir, mitchell-stellar, sammccall, owenpan.
MyDeveloperDay added projects: clang, clang-format.

Python2 has been removed from cygwin, this means anyone running the 
dump_format_style.py in a cygwin shell could pick up python3 instead

In Python3 all strings are unicode as the file is opened in binary mode we need 
to encode the contents string or we'll face the following error

  Traceback (most recent call last):
    File "./dump_format_style.py", line 228, in <module>
      output.write(contents)
  TypeError: a bytes-like object is required, not 'str'


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D79326

Files:
  clang/docs/tools/dump_format_style.py


Index: clang/docs/tools/dump_format_style.py
===================================================================
--- clang/docs/tools/dump_format_style.py
+++ clang/docs/tools/dump_format_style.py
@@ -225,4 +225,4 @@
 contents = substitute(contents, 'FORMAT_STYLE_OPTIONS', options_text)
 
 with open(DOC_FILE, 'wb') as output:
-  output.write(contents)
+  output.write(contents.encode())


Index: clang/docs/tools/dump_format_style.py
===================================================================
--- clang/docs/tools/dump_format_style.py
+++ clang/docs/tools/dump_format_style.py
@@ -225,4 +225,4 @@
 contents = substitute(contents, 'FORMAT_STYLE_OPTIONS', options_text)
 
 with open(DOC_FILE, 'wb') as output:
-  output.write(contents)
+  output.write(contents.encode())
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  • [PATCH] D79326: [clang-form... MyDeveloperDay via Phabricator via cfe-commits

Reply via email to