bpo-30125: Fix faulthandler.disable() on Windows (#1240)

* bpo-30125: Cleanup faulthandler.c

* Use size_t type for iterators
* Add { ... }

* bpo-30125: Fix faulthandler.disable() on Windows

On Windows, faulthandler.disable() now removes the exception handler
installed by faulthandler.enable().
This commit is contained in:
Victor Stinner 2017-04-21 18:06:13 +02:00 committed by GitHub
parent 2a1aed04b0
commit 46c2b81026
2 changed files with 31 additions and 24 deletions

View file

@ -754,6 +754,18 @@ class FaultHandlerTests(unittest.TestCase):
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__":