File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed
Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change 1+ NEXT VERSION [ ]
2+ ------------------
3+ * Crash of python's main thread when one attempts to interrupt it fixed.
4+
150.1.1 [ 2025.02.13]
26------------------
37* Number of deadlocks in ` runPyInMain ` fixed:
Original file line number Diff line number Diff line change @@ -362,7 +362,7 @@ mainThread lock_init lock_eval = do
362362 case r_init of
363363 False -> pure ()
364364 True -> mask_ $ fix $ \ loop ->
365- takeMVar lock_eval >>= \ case
365+ ( takeMVar lock_eval `catch` ( \ InterruptMain -> pure HereWeGoAgain )) >>= \ case
366366 EvalReq py resp -> do
367367 res <- (Right <$> runPy py) `catch` (pure . Left )
368368 putMVar resp res
@@ -373,6 +373,7 @@ mainThread lock_init lock_eval = do
373373 Py_Finalize();
374374 } |]
375375 putMVar resp ()
376+ HereWeGoAgain -> loop
376377
377378
378379doInializePythonIO :: IO Bool
@@ -431,6 +432,7 @@ doInializePythonIO = do
431432data EvalReq
432433 = forall a . EvalReq (Py a ) (MVar (Either SomeException a ))
433434 | StopReq (MVar () )
435+ | HereWeGoAgain
434436
435437data InterruptMain = InterruptMain
436438 deriving stock Show
You can’t perform that action at this time.
0 commit comments