[Python-checkins] cpython: regrtest: enable faulthandler in main() instead of if __name__ == '__main__':

victor.stinner python-checkins at python.org
Sun May 22 15:27:42 CEST 2011


http://hg.python.org/cpython/rev/02a4f0cb8fed
changeset:   70272:02a4f0cb8fed
user:        Victor Stinner <victor.stinner at haypocalc.com>
date:        Sun May 22 15:27:14 2011 +0200
summary:
  regrtest: enable faulthandler in main() instead of if __name__ == '__main__':

So it's also enabled when using "./python -m test".

files:
  Lib/test/regrtest.py |  7 ++++---
  1 files changed, 4 insertions(+), 3 deletions(-)


diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py
--- a/Lib/test/regrtest.py
+++ b/Lib/test/regrtest.py
@@ -265,6 +265,10 @@
     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 @@
     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

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list