diff options
| author | Steve Dower <steve.dower@microsoft.com> | 2017-06-05 15:54:15 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-06-05 15:54:15 -0700 |
| commit | e6a23c8f9a3ce05b759599696cc131c2d9d147ac (patch) | |
| tree | a94a11d18829920638d1f54d1f388bf39295a9e6 /Lib | |
| parent | 1bced56567335745f91676192fc39c06aab30da9 (diff) | |
| download | cpython-git-e6a23c8f9a3ce05b759599696cc131c2d9d147ac.tar.gz | |
bpo-30557: faulthandler now correctly filters and displays exception codes on Windows (#1924)
* bpo-30557: faulthandler now correctly filters and displays exception codes on Windows
* Adds test for non-fatal exceptions.
* Adds bpo number to comment.
Diffstat (limited to 'Lib')
| -rw-r--r-- | Lib/test/test_faulthandler.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/Lib/test/test_faulthandler.py b/Lib/test/test_faulthandler.py index 626e2458dc..c965d67db3 100644 --- a/Lib/test/test_faulthandler.py +++ b/Lib/test/test_faulthandler.py @@ -755,6 +755,32 @@ class FaultHandlerTests(unittest.TestCase): name) @unittest.skipUnless(MS_WINDOWS, 'specific to Windows') + def test_raise_nonfatal_exception(self): + # These exceptions are not strictly errors. Letting + # faulthandler display the traceback when they are + # raised is likely to result in noise. However, they + # may still terminate the process if there is no + # handler installed for them (which there typically + # is, e.g. for debug messages). + for exc in ( + 0x00000000, + 0x34567890, + 0x40000000, + 0x40001000, + 0x70000000, + 0x7FFFFFFF, + ): + output, exitcode = self.get_output(f""" + import faulthandler + faulthandler.enable() + faulthandler._raise_exception(0x{exc:x}) + """ + ) + self.assertEqual(output, []) + # Actual exception code has bit 4 cleared + self.assertEqual(exitcode, exc & ~0x10000000) + + @unittest.skipUnless(MS_WINDOWS, 'specific to Windows') def test_disable_windows_exc_handler(self): code = dedent(""" import faulthandler |
