diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2011-05-07 10:43:00 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2011-05-07 10:43:00 (GMT) |
commit | 7bba62fd68e3a2c410c37348cf679edea04c7718 (patch) | |
tree | 41614a5367bd7c7586df0eb3f53e3c7db7b3f362 /Lib/test | |
parent | c925617b5455867b7b393c6ca66f133aab450a6b (diff) | |
download | cpython-7bba62fd68e3a2c410c37348cf679edea04c7718.zip cpython-7bba62fd68e3a2c410c37348cf679edea04c7718.tar.gz cpython-7bba62fd68e3a2c410c37348cf679edea04c7718.tar.bz2 |
faulthandler: dump all threads by default
* Set the default value of all_threads arguments to True
* Py_FatalError() dumps all threads, instead of only the current thread
Dump only the current thread is not reliable. In some cases, Python is unable
to retrieve the state of the current thread and so is unable to dump the
traceback. faulthandler keeps a reference to the interpreter and so is always
able to dump the traceback of all threads.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_faulthandler.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Lib/test/test_faulthandler.py b/Lib/test/test_faulthandler.py index d08347d..dbc1917 100644 --- a/Lib/test/test_faulthandler.py +++ b/Lib/test/test_faulthandler.py @@ -75,7 +75,7 @@ class FaultHandlerTests(unittest.TestCase): return output.splitlines(), exitcode def check_fatal_error(self, code, line_number, name_regex, - filename=None, all_threads=False, other_regex=None): + filename=None, all_threads=True, other_regex=None): """ Check that the fault handler for fatal errors is enabled and check the traceback from the child process output. @@ -204,15 +204,15 @@ faulthandler._read_null() '(?:Segmentation fault|Bus error)', filename=filename) - def test_enable_threads(self): + def test_enable_single_thread(self): self.check_fatal_error(""" import faulthandler -faulthandler.enable(all_threads=True) +faulthandler.enable(all_threads=False) faulthandler._read_null() """.strip(), 3, '(?:Segmentation fault|Bus error)', - all_threads=True) + all_threads=False) def test_disable(self): code = """ @@ -252,9 +252,9 @@ import faulthandler def funcB(): if {has_filename}: with open({filename}, "wb") as fp: - faulthandler.dump_traceback(fp) + faulthandler.dump_traceback(fp, all_threads=False) else: - faulthandler.dump_traceback() + faulthandler.dump_traceback(all_threads=False) def funcA(): funcB() |