From 82009b3bde52ba09eae338d59adb1c06ac50c997 Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Tue, 7 Jun 2022 18:21:56 +0100 Subject: [PATCH] Use a better python problem matcher The old matcher only worked if the error was raised with `raise Exception('single quotes')`. This represents a miniscule fraction of errors; for instance, `l[37]` on a short list `l` can raise `IndexError`, and any call to a builtin C function is not going to trace back to a `raise` call. Instead, this just matches the first line without fail that comes after the context line. Note that this is still not foolproof; in Python 3.10, `SyntaxError`s are produced as ``` File "", line 1 foo(x, z for z in range(10), t, w) ^^^^^^^^^^^^^^^^^^^^ SyntaxError: Generator expression must be parenthesized ``` This matcher will incorrectly pick up ` ^^^^^^^^^^^^^^^^^^^^` as the error message, but the previous behavior was to not pick up any error message at all. As far as I can tell, this is impossible to handle correctly; the grammar of problem matchers is far too limiting. --- .github/python.json | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/python.json b/.github/python.json index 9c3095c0..c8b9fe5c 100644 --- a/.github/python.json +++ b/.github/python.json @@ -4,13 +4,16 @@ "owner": "python", "pattern": [ { - "regexp": "^\\s*File\\s\\\"(.*)\\\",\\sline\\s(\\d+),\\sin\\s(.*)$", + "regexp": "^ File \"([^\"]*)\", line (\\d+).*", "file": 1, "line": 2 }, { - "regexp": "^\\s*raise\\s(.*)\\(\\'(.*)\\'\\)$", - "message": 2 + "regexp": "^ .*$" + }, + { + "regexp": "^(?! File)(.*)\\s*$", + "message": 1 } ] }