diff --git a/tests/filtertraceback.py b/tests/filtertraceback.py --- a/tests/filtertraceback.py +++ b/tests/filtertraceback.py @@ -15,37 +15,14 @@ sys.stdout = io.TextIOWrapper( line_buffering=sys.stdout.line_buffering, ) -state = 'none' +in_tb = False for line in sys.stdin: - if state == 'none': - if line.startswith('Traceback '): - state = 'tb' - - elif state == 'tb': - if line.startswith(' File '): - state = 'file' - continue - - elif not line.startswith(' '): - state = 'none' - - elif not line.replace('^', '').replace('~', '').strip(): - # PEP 657: Fine-grained error locations in tracebacks - # ~~~~~~^^^^^^^^^ - continue - elif line.startswith(' '): - # Python 3.13 provide de full statement context - continue - - elif state == 'file': - # Ignore one line after " File ", but sometimes "File" lines are - # contiguous: - # File "", line 1007, in _find_and_load - # File "", line 986, in _find_and_load_unlocked - # File "", line 680, in _load_unlocked - if not line.startswith(' File '): - state = 'tb' - continue - - print(line, end='') + do_print = not in_tb + if line.startswith('Traceback '): + in_tb = True + elif not line.startswith(' '): + in_tb = False + do_print = True + if do_print: + print(line, end='') diff --git a/tests/test-http-bad-server.t b/tests/test-http-bad-server.t --- a/tests/test-http-bad-server.t +++ b/tests/test-http-bad-server.t @@ -246,8 +246,6 @@ Now do a variation using POST to send ar read limit reached; closing socket $LOCALIP - - [$ERRDATE$] Exception happened during processing request '/?cmd=batch': (glob) Traceback (most recent call last): - rctx, req, res, self.check_perm (py313 !) - ) (py313 !) Exception: connection closed after receiving N bytes