[Lldb-commits] [clang] [clang-tools-extra] [compiler-rt] [libcxx] [lld] [lldb] [llvm] [mlir] Fix SyntaxWarning messages from python 3.12 (PR #86806)

via lldb-commits lldb-commits at lists.llvm.org
Wed Mar 27 07:55:55 PDT 2024


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 e82765bf07a978674c0e75c8b2e20f154ae24a4c...c7d6289573379be760ca9d691d62e0f87ba0ee8a .github/workflows/version-check.py clang-tools-extra/clang-tidy/add_new_check.py clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py clang-tools-extra/docs/clang-tidy/checks/gen-static-analyzer-docs.py clang/docs/tools/dump_ast_matchers.py clang/test/Analysis/check-analyzer-fixit.py clang/utils/ABITest/TypeGen.py compiler-rt/lib/asan/scripts/asan_symbolize.py cross-project-tests/debuginfo-tests/dexter/dex/command/ParseCommand.py cross-project-tests/lit.cfg.py libcxx/test/libcxx/transitive_includes.gen.py libcxx/utils/generate_escaped_output_table.py libcxx/utils/generate_width_estimation_table.py lld/test/MachO/tools/validate-unwind-info.py lld/utils/benchmark.py lldb/examples/python/crashlog.py lldb/examples/python/delta.py lldb/examples/python/gdbremote.py lldb/examples/python/jump.py lldb/examples/python/performance.py lldb/examples/python/symbolication.py lldb/packages/Python/lldbsuite/test/decorators.py lldb/packages/Python/lldbsuite/test/lldbpexpect.py lldb/packages/Python/lldbsuite/test/lldbtest.py lldb/packages/Python/lldbsuite/test/test_runner/process_control.py lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py lldb/packages/Python/lldbsuite/test/tools/lldb-server/lldbgdbserverutils.py lldb/test/API/commands/command/backticks/TestBackticksInAlias.py lldb/test/API/commands/expression/memory-allocation/TestMemoryAllocSettings.py lldb/test/API/commands/expression/test/TestExprs.py lldb/test/API/commands/gui/expand-threads-tree/TestGuiExpandThreadsTree.py lldb/test/API/commands/help/TestHelp.py lldb/test/API/commands/process/launch-with-shellexpand/TestLaunchWithShellExpand.py lldb/test/API/commands/register/register/TestRegistersUnavailable.py lldb/test/API/commands/settings/TestSettings.py lldb/test/API/commands/target/basic/TestTargetCommand.py lldb/test/API/commands/target/dump-separate-debug-info/dwo/TestDumpDwo.py lldb/test/API/commands/target/dump-separate-debug-info/oso/TestDumpOso.py lldb/test/API/commands/trace/TestTraceDumpInfo.py lldb/test/API/commands/trace/TestTraceEvents.py lldb/test/API/commands/trace/TestTraceStartStop.py lldb/test/API/commands/trace/TestTraceTSC.py lldb/test/API/driver/quit_speed/TestQuitWithProcess.py lldb/test/API/functionalities/breakpoint/breakpoint_by_line_and_column/TestBreakpointByLineAndColumn.py lldb/test/API/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py lldb/test/API/functionalities/data-formatter/data-formatter-advanced/TestDataFormatterAdv.py lldb/test/API/functionalities/data-formatter/data-formatter-cpp/TestDataFormatterCpp.py lldb/test/API/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSContainer.py lldb/test/API/functionalities/data-formatter/data-formatter-skip-summary/TestDataFormatterSkipSummary.py lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unordered/TestDataFormatterGenericUnordered.py lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/TestLibCxxAtomic.py lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/initializerlist/TestInitializerList.py lldb/test/API/functionalities/data-formatter/type_summary_list_arg/TestTypeSummaryListArg.py lldb/test/API/functionalities/memory-region/TestMemoryRegion.py lldb/test/API/functionalities/target_var/TestTargetVar.py lldb/test/API/iohandler/completion/TestIOHandlerCompletion.py lldb/test/API/lang/c/function_types/TestFunctionTypes.py lldb/test/API/lang/c/register_variables/TestRegisterVariables.py lldb/test/API/lang/c/set_values/TestSetValues.py lldb/test/API/lang/c/strings/TestCStrings.py lldb/test/API/lang/c/tls_globals/TestTlsGlobals.py lldb/test/API/lang/cpp/char1632_t/TestChar1632T.py lldb/test/API/lang/cpp/class_static/TestStaticVariables.py lldb/test/API/lang/cpp/class_types/TestClassTypes.py lldb/test/API/lang/cpp/dynamic-value/TestDynamicValue.py lldb/test/API/lang/cpp/namespace/TestNamespace.py lldb/test/API/lang/cpp/signed_types/TestSignedTypes.py lldb/test/API/lang/cpp/unsigned_types/TestUnsignedTypes.py lldb/test/API/lang/mixed/TestMixedLanguages.py lldb/test/API/lang/objc/foundation/TestObjCMethods.py lldb/test/API/lang/objc/foundation/TestObjCMethodsNSArray.py lldb/test/API/lang/objc/foundation/TestObjCMethodsNSError.py lldb/test/API/lang/objc/foundation/TestObjCMethodsString.py lldb/test/API/lang/objc/objc-dynamic-value/TestObjCDynamicValue.py lldb/test/API/lang/objcxx/objc-builtin-types/TestObjCBuiltinTypes.py lldb/test/API/linux/aarch64/mte_core_file/TestAArch64LinuxMTEMemoryTagCoreFile.py lldb/test/API/linux/aarch64/mte_tag_access/TestAArch64LinuxMTEMemoryTagAccess.py lldb/test/API/linux/aarch64/mte_tag_faults/TestAArch64LinuxMTEMemoryTagFaults.py lldb/test/API/linux/aarch64/tagged_memory_region/TestAArch64LinuxTaggedMemoryRegion.py lldb/test/API/macosx/add-dsym/TestAddDsymDownload.py lldb/test/API/macosx/lc-note/firmware-corefile/TestFirmwareCorefiles.py lldb/test/API/macosx/lc-note/kern-ver-str/TestKernVerStrLCNOTE.py lldb/test/API/macosx/lc-note/multiple-binary-corefile/TestMultipleBinaryCorefile.py lldb/test/API/macosx/simulator/TestSimulatorPlatform.py lldb/test/API/macosx/skinny-corefile/TestSkinnyCorefile.py lldb/test/API/python_api/target-arch-from-module/TestTargetArchFromModule.py lldb/test/API/source-manager/TestSourceManager.py lldb/test/API/tools/lldb-server/TestGdbRemoteModuleInfo.py lldb/test/API/tools/lldb-server/TestPtyServer.py lldb/test/API/tools/lldb-server/registers-target-xml-reading/TestGdbRemoteTargetXmlPacket.py lldb/test/API/types/AbstractBase.py lldb/utils/lui/sourcewin.py llvm/test/CodeGen/NVPTX/wmma.py llvm/tools/opt-viewer/opt-viewer.py llvm/utils/DSAclean.py llvm/utils/DSAextract.py llvm/utils/add_argument_names.py llvm/utils/convert-constraint-log-to-z3.py llvm/utils/extract_symbols.py llvm/utils/extract_vplan.py llvm/utils/git/github-automation.py llvm/utils/indirect_calls.py llvm/utils/relative_lines.py llvm/utils/update_test_prefix.py mlir/test/Integration/Dialect/SparseTensor/python/test_output.py mlir/utils/spirv/gen_spirv_dialect.py
``````````

</details>

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

``````````diff
--- libcxx/test/libcxx/transitive_includes.gen.py	2024-03-27 14:26:55.000000 +0000
+++ libcxx/test/libcxx/transitive_includes.gen.py	2024-03-27 14:55:21.669458 +0000
@@ -29,39 +29,46 @@
 # for std in c++03 c++11 c++14 c++17 c++20 c++23 c++26; do <build>/bin/llvm-lit --param std=$std libcxx/test/libcxx/transitive_includes.gen.py; done
 regenerate_expected_results = False
 
 BLOCKLIT = '' # block Lit from interpreting a RUN/XFAIL/etc inside the generation script
 if regenerate_expected_results:
-  print(f"""\
+    print(
+        f"""\
 //--- generate-transitive-includes.sh.cpp
 // RUN{BLOCKLIT}: mkdir %t
-""")
+"""
+    )
 
-  all_traces = []
-  for header in sorted(public_headers):
-    if header.endswith('.h'): # Skip C compatibility or detail headers
-      continue
+    all_traces = []
+    for header in sorted(public_headers):
+        if header.endswith(".h"):  # Skip C compatibility or detail headers
+            continue
 
-    normalized_header = re.sub('/', '_', header)
-    print(f"""\
+        normalized_header = re.sub("/", "_", header)
+        print(
+            f"""\
 // RUN{BLOCKLIT}: echo "#include <{header}>" | %{{cxx}} -xc++ - %{{flags}} %{{compile_flags}} --trace-includes -fshow-skipped-includes --preprocess > /dev/null 2> %t/trace-includes.{normalized_header}.txt
-""")
-    all_traces.append(f'%t/trace-includes.{normalized_header}.txt')
+"""
+        )
+        all_traces.append(f"%t/trace-includes.{normalized_header}.txt")
 
-  print(f"""\
+    print(
+        f"""\
 // RUN{BLOCKLIT}: %{{python}} %{{libcxx-dir}}/test/libcxx/transitive_includes_to_csv.py {' '.join(all_traces)} > %{{libcxx-dir}}/test/libcxx/transitive_includes/%{{cxx_std}}.csv
-""")
+"""
+    )
 
 else:
-  for header in public_headers:
-    if header.endswith('.h'): # Skip C compatibility or detail headers
-      continue
+    for header in public_headers:
+        if header.endswith(".h"):  # Skip C compatibility or detail headers
+            continue
 
-    # Escape slashes for the awk command below
-    escaped_header = header.replace('/', '\\/')
+        # Escape slashes for the awk command below
+        escaped_header = header.replace("/", "\\/")
 
-    print(f"""\
+        print(
+            f"""\
 //--- {header}.sh.cpp
 {lit_header_restrictions.get(header, '')}
 
 // TODO: Fix this test to make it work with localization or wide characters disabled
 // UNSUPPORTED{BLOCKLIT}: no-localization, no-wide-characters, no-threads, no-filesystem, libcpp-has-no-incomplete-tzdb, no-tzdb
@@ -85,6 +92,7 @@
 // RUN{BLOCKLIT}: %{{cxx}} %s %{{flags}} %{{compile_flags}} --trace-includes -fshow-skipped-includes --preprocess > /dev/null 2> %t/trace-includes.txt
 // RUN{BLOCKLIT}: %{{python}} %{{libcxx-dir}}/test/libcxx/transitive_includes_to_csv.py %t/trace-includes.txt > %t/actual_transitive_includes.csv
 // RUN{BLOCKLIT}: cat %{{libcxx-dir}}/test/libcxx/transitive_includes/%{{cxx_std}}.csv | awk '/^{escaped_header} / {{ print }}' > %t/expected_transitive_includes.csv
 // RUN{BLOCKLIT}: diff -w %t/expected_transitive_includes.csv %t/actual_transitive_includes.csv
 #include <{header}>
-""")
+"""
+        )
--- lldb/test/API/commands/trace/TestTraceEvents.py	2024-03-27 14:26:55.000000 +0000
+++ lldb/test/API/commands/trace/TestTraceEvents.py	2024-03-27 14:55:24.483261 +0000
@@ -66,11 +66,11 @@
         self.expect("si")
         # We ensure that the paused events are printed correctly forward
         self.expect(
             "thread trace dump instructions -e -f",
             patterns=[
-                fr"""thread #1: tid = .*
+                rf"""thread #1: tid = .*
     0: \(event\) trace synchronization point \[offset \= 0x0xec0\]
     1: \(event\) hardware disabled tracing
   a.out`main \+ 23 at main.cpp:12
     2: {ADDRESS_REGEX}    movl .*
     3: \(event\) software disabled tracing
@@ -100,11 +100,11 @@
 
         # We ensure that the paused events are printed correctly backward
         self.expect(
             "thread trace dump instructions -e --id 18",
             patterns=[
-                fr"""thread #1: tid = .*
+                rf"""thread #1: tid = .*
   a.out`symbol stub for: foo\(\)
     18: {ADDRESS_REGEX}    jmpq .*
     17: \(event\) software disabled tracing
   a.out`main \+ 63 at main.cpp:16
     16: {ADDRESS_REGEX}    callq  .* ; symbol stub for: foo\(\)
--- lldb/test/API/commands/trace/TestTraceStartStop.py	2024-03-27 14:26:55.000000 +0000
+++ lldb/test/API/commands/trace/TestTraceStartStop.py	2024-03-27 14:55:24.564767 +0000
@@ -242,22 +242,22 @@
         # We can reconstruct the single instruction executed in the first line
         self.expect("n")
         self.expect(
             "thread trace dump instructions -f",
             patterns=[
-                fr"""thread #1: tid = .*
+                rf"""thread #1: tid = .*
   a.out`main \+ 4 at main.cpp:2
     2: {ADDRESS_REGEX}    movl"""
             ],
         )
 
         # We can reconstruct the instructions up to the second line
         self.expect("n")
         self.expect(
             "thread trace dump instructions -f",
             patterns=[
-                fr"""thread #1: tid = .*
+                rf"""thread #1: tid = .*
   a.out`main \+ 4 at main.cpp:2
     2: {ADDRESS_REGEX}    movl .*
   a.out`main \+ 11 at main.cpp:4
     4: {ADDRESS_REGEX}    movl .*
     6: {ADDRESS_REGEX}    jmp  .* ; <\+28> at main.cpp:4
@@ -267,11 +267,11 @@
         )
 
         self.expect(
             "thread trace dump instructions",
             patterns=[
-                fr"""thread #1: tid = .*
+                rf"""thread #1: tid = .*
   a.out`main \+ 32 at main.cpp:4
     10: {ADDRESS_REGEX}    jle  .* ; <\+20> at main.cpp:5
     8: {ADDRESS_REGEX}    cmpl .*
     6: {ADDRESS_REGEX}    jmp  .* ; <\+28> at main.cpp:4
     4: {ADDRESS_REGEX}    movl .*
@@ -295,20 +295,20 @@
         self.expect("thread trace start")
         self.expect("n")
         self.expect(
             "thread trace dump instructions -f",
             patterns=[
-                fr"""thread #1: tid = .*
+                rf"""thread #1: tid = .*
   a.out`main \+ 20 at main.cpp:5
     2: {ADDRESS_REGEX}    xorl"""
             ],
         )
 
         self.expect(
             "thread trace dump instructions",
             patterns=[
-                fr"""thread #1: tid = .*
+                rf"""thread #1: tid = .*
   a.out`main \+ 20 at main.cpp:5
     2: {ADDRESS_REGEX}    xorl"""
             ],
         )
 
--- lldb/test/API/functionalities/data-formatter/data-formatter-advanced/TestDataFormatterAdv.py	2024-03-27 14:26:55.000000 +0000
+++ lldb/test/API/functionalities/data-formatter/data-formatter-advanced/TestDataFormatterAdv.py	2024-03-27 14:55:24.828725 +0000
@@ -102,11 +102,13 @@
             'frame variable int_array --summary-string "${*var[0-1]}"', substrs=["3"]
         )
 
         self.runCmd("type summary clear")
 
-        self.runCmd('type summary add --summary-string "${var[0-1]}" -x "int\\[[0-9]\\]"')
+        self.runCmd(
+            'type summary add --summary-string "${var[0-1]}" -x "int\\[[0-9]\\]"'
+        )
 
         self.expect("frame variable int_array", substrs=["1,2"])
 
         self.runCmd('type summary add --summary-string "${var[0-1]}" "int[]"')
 
--- lldb/test/API/linux/aarch64/mte_tag_access/TestAArch64LinuxMTEMemoryTagAccess.py	2024-03-27 14:26:55.000000 +0000
+++ lldb/test/API/linux/aarch64/mte_tag_access/TestAArch64LinuxMTEMemoryTagAccess.py	2024-03-27 14:55:25.948860 +0000
@@ -522,11 +522,13 @@
         )
 
         # End of range is untagged
         self.expect(
             'memory read mte_buf+page_size-16 mte_buf+page_size+16 -f "x" -l 1 -s 16 --show-tags',
-            patterns=[r"0x[0-9A-Fa-f]+f0: 0x0+ \(tag: 0xf\)\n" "0x[0-9A-Fa-f]+00: 0x0+"],
+            patterns=[
+                r"0x[0-9A-Fa-f]+f0: 0x0+ \(tag: 0xf\)\n" "0x[0-9A-Fa-f]+00: 0x0+"
+            ],
         )
 
         # The smallest MTE range we can get is a single page so we just check
         # parts of this result. Where we read from before the tagged page to after it.
         # Add --force here because we're reading just over 4k.
--- lldb/test/API/linux/aarch64/tagged_memory_region/TestAArch64LinuxTaggedMemoryRegion.py	2024-03-27 14:26:55.000000 +0000
+++ lldb/test/API/linux/aarch64/tagged_memory_region/TestAArch64LinuxTaggedMemoryRegion.py	2024-03-27 14:55:26.006061 +0000
@@ -37,11 +37,12 @@
             substrs=["stopped", "stop reason = breakpoint"],
         )
 
         # Despite the non address bits we should find a region
         self.expect(
-            "memory region the_page", patterns=[r"\[0x[0-9A-Fa-f]+-0x[0-9A-Fa-f]+\) r-x"]
+            "memory region the_page",
+            patterns=[r"\[0x[0-9A-Fa-f]+-0x[0-9A-Fa-f]+\) r-x"],
         )
 
         # Check that the usual error message is displayed after repeating
         # the command until the last region.
         self.runCmd("memory region 0")
@@ -66,7 +67,8 @@
             self.runCmd("memory region")
 
         # This should not error, since the user supplied address overrides
         # the previous end address.
         self.expect(
-            "memory region the_page", patterns=[r"\[0x[0-9A-Fa-f]+-0x[0-9A-Fa-f]+\) r-x"]
+            "memory region the_page",
+            patterns=[r"\[0x[0-9A-Fa-f]+-0x[0-9A-Fa-f]+\) r-x"],
         )

``````````

</details>


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


More information about the lldb-commits mailing list