bpo-30125: Fix faulthandler.disable() on Windows (#1243)
On Windows, faulthandler.disable() now removes the exception handler
installed by faulthandler.enable().
diff --git a/Lib/test/test_faulthandler.py b/Lib/test/test_faulthandler.py
index bdd8d1a..01cbae3 100644
--- a/Lib/test/test_faulthandler.py
+++ b/Lib/test/test_faulthandler.py
@@ -755,6 +755,18 @@
3,
name)
+ @unittest.skipUnless(MS_WINDOWS, 'specific to Windows')
+ def test_disable_windows_exc_handler(self):
+ code = dedent("""
+ import faulthandler
+ faulthandler.enable()
+ faulthandler.disable()
+ code = faulthandler._EXCEPTION_ACCESS_VIOLATION
+ faulthandler._raise_exception(code)
+ """)
+ output, exitcode = self.get_output(code)
+ self.assertEqual(output, [])
+ self.assertEqual(exitcode, 0xC0000005)
if __name__ == "__main__":