]> granicus.if.org Git - python/commitdiff
bpo-30258: Fix handling of child error in regrtest (#1477)
authorVictor Stinner <victor.stinner@gmail.com>
Fri, 5 May 2017 08:28:35 +0000 (10:28 +0200)
committerGitHub <noreply@github.com>
Fri, 5 May 2017 08:28:35 +0000 (10:28 +0200)
Don't stop the worker thread if a child failed.

Lib/test/regrtest.py

index 413d7f906490749bbaf149619d40dad0db822956..9874dded97ad424957d561a20ac24283a6ce2a93 100755 (executable)
@@ -555,16 +555,16 @@ def main(tests=None, testdir=None, verbose=0, quiet=False,
                     # comes from the shutdown of the interpreter in the subcommand.
                     stderr = debug_output_pat.sub("", stderr)
 
-                    if retcode != 0:
+                    if retcode == 0:
+                        stdout, _, result = stdout.strip().rpartition("\n")
+                        if not result:
+                            output.put((None, None, None, None))
+                            return
+
+                        result = json.loads(result)
+                    else:
                         result = (CHILD_ERROR, "Exit code %s" % retcode)
-                        output.put((test, stdout.rstrip(), stderr.rstrip(),
-                                    result))
 
-                    stdout, _, result = stdout.strip().rpartition("\n")
-                    if not result:
-                        output.put((None, None, None, None))
-                        return
-                    result = json.loads(result)
                     output.put((test, stdout.rstrip(), stderr.rstrip(), result))
             except BaseException:
                 output.put((None, None, None, None))