]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
regrtest: enable faulthandler in main() instead of if __name__ == '__main__':
authorVictor Stinner <victor.stinner@haypocalc.com>
Sun, 22 May 2011 13:27:14 +0000 (15:27 +0200)
committerVictor Stinner <victor.stinner@haypocalc.com>
Sun, 22 May 2011 13:27:14 +0000 (15:27 +0200)
So it's also enabled when using "./python -m test".

Lib/test/regrtest.py

index 120bd6089e45025db844f7a16e7b4ff45e2c4ef1..2a08de4c72d1b0df15b06961caf6dcc48b8d41fa 100755 (executable)
@@ -265,6 +265,10 @@ def main(tests=None, testdir=None, verbose=0, quiet=False,
     directly to set the values that would normally be set by flags
     on the command line.
     """
+
+    # Display the Python traceback fatal errors (e.g. segfault)
+    faulthandler.enable(all_threads=True)
+
     if hasattr(faulthandler, 'dump_tracebacks_later'):
         timeout = 60*60
     else:
@@ -1588,9 +1592,6 @@ def _make_temp_dir_for_build(TEMPDIR):
     return TEMPDIR, TESTCWD
 
 if __name__ == '__main__':
-    # Display the Python traceback on segfault and division by zero
-    faulthandler.enable(all_threads=True)
-
     # Remove regrtest.py's own directory from the module search path. Despite
     # the elimination of implicit relative imports, this is still needed to
     # ensure that submodules of the test package do not inappropriately appear