self.assertEqual(output, [])
self.assertEqual(exitcode, 0xC0000005)
+ def test_cancel_later_without_dump_traceback_later(self):
+ # bpo-37933: Calling cancel_dump_traceback_later()
+ # without dump_traceback_later() must not segfault.
+ code = dedent("""
+ import faulthandler
+ faulthandler.cancel_dump_traceback_later()
+ """)
+ output, exitcode = self.get_output(code)
+ self.assertEqual(output, [])
+ self.assertEqual(exitcode, 0)
+
if __name__ == "__main__":
unittest.main()
static void
cancel_dump_traceback_later(void)
{
+ /* If not scheduled, nothing to cancel */
+ if (!thread.cancel_event) {
+ return;
+ }
+
/* Notify cancellation */
PyThread_release_lock(thread.cancel_event);