[llvm] [lit] Clean up internal shell parse errors with ScriptFatal (PR #68496)

Vlad Serebrennikov via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 10 21:18:14 PDT 2023


================
@@ -1009,7 +1020,8 @@ def formatOutput(title, data, limit=None):
     return out
 
 
-# Normally returns out, err, exitCode, timeoutInfo.
+# Always either returns the tuple (out, err, exitCode, timeoutInfo) or raises a
----------------
Endilll wrote:

> If I understand that correctly, I'd be changing the return type rather than just documenting/annotating it. Maybe the type annotation plus a comment naming the fields is enough?

If you intend to add names to `typing.Tuple[str, str, int, typing.Optional[str]]`, I'm not sure it's possible in a way that won't scare type checkers away, but I'm sure it's not conventional for Python. If you want to name tuple members, you should create a type with `namedtuple()`, and return it. 
https://github.com/llvm/llvm-project/pull/68496/files#diff-06d85faa2a7a6970de33ccb78e3e004456eb51ab7303330ec52a5e35db92d415R53 would definitely benefit from named arguments.

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


More information about the llvm-commits mailing list