[all-commits] [llvm/llvm-project] 3125aa: [clang-format] ensure dump_format_style.py works w...

MyDeveloperDay via All-commits all-commits at lists.llvm.org
Thu May 7 11:52:43 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 3125aa99593db9fe17c825fd5984b333bb86437f
      https://github.com/llvm/llvm-project/commit/3125aa99593db9fe17c825fd5984b333bb86437f
  Author: mydeveloperday <mydeveloperday at gmail.com>
  Date:   2020-05-07 (Thu, 07 May 2020)

  Changed paths:
    M clang/docs/tools/dump_format_style.py

  Log Message:
  -----------
  [clang-format] ensure dump_format_style.py works with Python3 correctly

Summary:
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'
```

Reviewed By: krasimir

Subscribers: cfe-commits

Tags: #clang, #clang-format

Differential Revision: https://reviews.llvm.org/D79326




More information about the All-commits mailing list