[llvm] [LIT] remove `to_unicode`, `to_string`, and `to_bytes` helpers (PR #165950)

via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 31 18:20:22 PDT 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {darker}-->


:warning: Python code formatter, darker found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
darker --check --diff -r origin/main...HEAD llvm/utils/lit/lit/TestRunner.py llvm/utils/lit/lit/builtin_commands/diff.py llvm/utils/lit/lit/formats/googletest.py llvm/utils/lit/lit/llvm/config.py llvm/utils/lit/lit/util.py llvm/utils/lit/tests/shtest-glob.py
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from darker here.
</summary>

``````````diff
--- lit/TestRunner.py	2025-11-01 01:18:36.000000 +0000
+++ lit/TestRunner.py	2025-11-01 01:19:54.877790 +0000
@@ -395,11 +395,11 @@
         stdout = StringIO()
     elif kIsWindows:
         # Reopen stdout with specifying `newline` to avoid CRLF translation.
         # The versions of echo we are replacing on Windows all emit plain LF,
         # and the LLVM tests now depend on this.
-        stdout = open(stdout.name, stdout.mode, newline='')
+        stdout = open(stdout.name, stdout.mode, newline="")
         opened_files.append((None, None, stdout, None))
 
     # Implement echo flags. We only support -e and -n, and not yet in
     # combination. We have to ignore unknown flags, because `echo "-D FOO"`
     # prints the dash.
@@ -1455,13 +1455,11 @@
         last_match_position = 0
         for match in keywords_re.finditer(data):
             # Compute the updated line number by counting the intervening
             # newlines.
             match_position = match.start()
-            line_number += data.count(
-                b"\n", last_match_position, match_position
-            )
+            line_number += data.count(b"\n", last_match_position, match_position)
             last_match_position = match_position
 
             # Convert the keyword and line to UTF-8 strings and yield the
             # command.
             #

``````````

</details>


https://github.com/llvm/llvm-project/pull/165950


More information about the llvm-commits mailing list