Skip to content

Commit 1b66c72

Browse files
committed
Warnings
1 parent 8f8d2a6 commit 1b66c72

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

src/Python/Internal/Eval.hs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ import Control.Monad.IO.Class
5353
import Control.Monad.Trans.Cont
5454
import Data.Maybe
5555
import Data.Function
56-
import Data.ByteString qualified as BS
5756
import Data.ByteString.Unsafe qualified as BS
5857
import Foreign.Concurrent qualified as GHC
5958
import Foreign.Ptr
@@ -305,10 +304,10 @@ finalizePython = join $ atomically $ readTVar globalPyState >>= \case
305304
Py_Finalize();
306305
} |]
307306
-- We need to call Py_Finalize on main thread
308-
RunningN _ eval _ tid_gc -> checkLock $ do
307+
RunningN _ lock_eval _ tid_gc -> checkLock $ do
309308
killThread tid_gc
310309
resp <- newEmptyMVar
311-
putMVar eval $ StopReq resp
310+
putMVar lock_eval $ StopReq resp
312311
takeMVar resp
313312
where
314313
checkLock action = readTVar globalPyLock >>= \case
@@ -485,17 +484,17 @@ runPyInMain py
485484
InInitialization -> retry
486485
InFinalization -> retry
487486
Running1 -> throwSTM $ PyInternalError "runPyInMain: Running1"
488-
RunningN _ eval tid_main _ -> readTVar globalPyLock >>= \case
487+
RunningN _ eval_lock tid_main _ -> readTVar globalPyLock >>= \case
489488
LockUninialized -> throwSTM PythonNotInitialized
490489
LockFinalized -> throwSTM PythonIsFinalized
491490
LockedByGC -> retry
492491
-- We need to send closure to main python thread when we're grabbing lock.
493492
LockUnlocked -> do
494493
writeTVar globalPyLock $ Locked tid_main []
495494
pure ( atomically (releaseLock tid_main)
496-
, evalInOtherThread tid_main eval
495+
, evalInOtherThread tid_main eval_lock
497496
)
498-
-- If we can grab lock and main thread taken lock we're
497+
-- If we513 can grab lock and main thread taken lock we're
499498
-- already executing on main thread. We can simply execute code
500499
Locked t ts
501500
| t /= tid
@@ -508,12 +507,12 @@ runPyInMain py
508507
| otherwise -> do
509508
writeTVar globalPyLock $ Locked tid_main (t : ts)
510509
pure ( atomically (releaseLock tid_main)
511-
, evalInOtherThread tid_main eval
510+
, evalInOtherThread tid_main eval_lock
512511
)
513512
--
514-
evalInOtherThread tid_main eval = do
513+
evalInOtherThread tid_main eval_lock = do
515514
r <- mask_ $ do resp <- newEmptyMVar
516-
putMVar eval $ EvalReq py resp
515+
putMVar eval_lock $ EvalReq py resp
517516
takeMVar resp `onException` throwTo tid_main InterruptMain
518517
either throwM pure r
519518

test/TST/Util.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import Control.Monad.Catch
66
import Test.Tasty.HUnit
77

88
import Python.Inline
9-
import Python.Inline.Types
109

1110
throwsPy :: Py () -> Py ()
1211
throwsPy io = (io >> liftIO (assertFailure "Evaluation should raise python exception"))

0 commit comments

Comments
 (0)