Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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]
----------------
Expand Down
2 changes: 1 addition & 1 deletion cbits/python.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,8 @@ void inline_py_clear_error(void) {
locals = PyDict_New();
code = Py_CompileString("None", "<interactive>", 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();
}

Expand Down
2 changes: 1 addition & 1 deletion examples/matplotlib-gui/matplotlib-gui.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Library
Py.Extra

executable mpl-gui-test
buildable: false
buildable: False
--
Default-Language: GHC2021
main-is: test.hs
Expand Down
1 change: 0 additions & 1 deletion examples/matplotlib-gui/src/Py/Matplotlib/GUI.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion inline-python.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions src/Python/Inline/QQ.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
|]

Loading