From 1fcdf07e98838ea183503c1c7b4c5404a5f1ee05 Mon Sep 17 00:00:00 2001 From: Alexey Khudyakov Date: Wed, 7 Oct 2026 23:28:21 +0300 Subject: [PATCH 1/4] Fix warnings --- cbits/python.c | 2 +- examples/matplotlib-gui/matplotlib-gui.cabal | 2 +- examples/matplotlib-gui/src/Py/Matplotlib/GUI.hs | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/cbits/python.c b/cbits/python.c index 00502b4..b87b2c2 100644 --- a/cbits/python.c +++ b/cbits/python.c @@ -252,8 +252,8 @@ void inline_py_clear_error(void) { locals = PyDict_New(); code = Py_CompileString("None", "", Py_eval_input); } - PyObject* r = PyEval_EvalCode(code, globals, locals); // None is immortal. No need to decrement counter + PyEval_EvalCode(code, globals, locals); PyErr_Clear(); } diff --git a/examples/matplotlib-gui/matplotlib-gui.cabal b/examples/matplotlib-gui/matplotlib-gui.cabal index 49cb705..12f9070 100644 --- a/examples/matplotlib-gui/matplotlib-gui.cabal +++ b/examples/matplotlib-gui/matplotlib-gui.cabal @@ -50,7 +50,7 @@ Library Py.Extra executable mpl-gui-test - buildable: false + buildable: False -- Default-Language: GHC2021 main-is: test.hs diff --git a/examples/matplotlib-gui/src/Py/Matplotlib/GUI.hs b/examples/matplotlib-gui/src/Py/Matplotlib/GUI.hs index 3ed21f1..1773732 100644 --- a/examples/matplotlib-gui/src/Py/Matplotlib/GUI.hs +++ b/examples/matplotlib-gui/src/Py/Matplotlib/GUI.hs @@ -25,7 +25,6 @@ import Control.Monad.Catch import Control.Monad.IO.Class import Data.Typeable import Data.Function -import Language.Haskell.TH.Syntax qualified as TH import Python.Inline import Python.Inline.QQ From cfb3b4c308cf34d79c3726b5e37d1e3a0be8d844 Mon Sep 17 00:00:00 2001 From: Alexey Khudyakov Date: Wed, 7 Oct 2026 23:28:31 +0300 Subject: [PATCH 2/4] GHC<=9.6 cannot compiler record constructor --- src/Python/Inline/QQ.hs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Python/Inline/QQ.hs b/src/Python/Inline/QQ.hs index 0b6d443..39af688 100644 --- a/src/Python/Inline/QQ.hs +++ b/src/Python/Inline/QQ.hs @@ -156,7 +156,8 @@ pyfun = QuasiQuoter pySource :: FilePath -> TH.Q TH.Exp pySource path = do TH.addDependentFile path - [| PyQuote { code = $(TH.lift =<< TH.runIO (codeFromString <$> readFile path)) - , binder = mempty - } |] + [| PyQuote + ($(TH.lift =<< TH.runIO (codeFromString <$> readFile path))) + mempty + |] From 07855b2db4c63fdb853b0564432469c91220ee8b Mon Sep 17 00:00:00 2001 From: Alexey Khudyakov Date: Wed, 7 Oct 2026 23:41:02 +0300 Subject: [PATCH 3/4] Update changelog --- ChangeLog.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 73bf8d2..e57df72 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -17,8 +17,16 @@ flag is set. Default behavior is unchanged. * Haskell exception raised in haskell callback will be rethrown if not caught by python instead of being converted to `PyError`. -* Memory leak in exception handling is fixed. Python exception object were never - freed when exception propagated to haskell side. +* `evalPyFunction` is added to company of `eval` and `exec`. It uses new + `PyQuoteFun` data type as parameter. +* `pySource` quasiquoter added. It loads python code from file. +* `createModule` added which gives standard way of defining python code. +* Bug fixes: + - Memory leak in exception handling is fixed. Python exception object were never + freed when exception propagated to haskell side. + - `bindVar` and `codeFromString`, `codeFromText` violated memory safety but + happened to work correctly when strings were created by TH. Consider upgrade + if using them. 0.2.1.0 [2026.01.13] ---------------- From dee1a6d6b3826aa763eba62724f19811f9103b5b Mon Sep 17 00:00:00 2001 From: Alexey Khudyakov Date: Thu, 15 Oct 2026 20:44:39 +0300 Subject: [PATCH 4/4] Prepare 0.3.0.0 release --- ChangeLog.md | 2 +- inline-python.cabal | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index e57df72..681d30e 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,4 +1,4 @@ -0.3.0.0 [XXXX.XX.XX] +0.3.0.0 [2026.10.15] -------------------- * Support for asynchronous execution added in module `Python.Inline.Async`. It uses API modelled after `async` package. Such computations could be diff --git a/inline-python.cabal b/inline-python.cabal index 5256541..a5cfb8d 100644 --- a/inline-python.cabal +++ b/inline-python.cabal @@ -2,7 +2,7 @@ Cabal-Version: 3.0 Build-Type: Custom Name: inline-python -Version: 0.2.1.0 +Version: 0.3.0.0 Synopsis: Python interpreter embedded into haskell. Description: This package embeds python interpreter into haskell program and