From f9014d168431a8f3bdcde58de3a12f79d1b82ba4 Mon Sep 17 00:00:00 2001 From: Alexey Khudyakov Date: Mon, 12 Jan 2026 16:23:20 +0300 Subject: [PATCH 1/4] Attempt to run CI with different python versions --- .github/workflows/ci.yml | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3fb5604..4c33351 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,17 +12,24 @@ defaults: jobs: cabal: - name: ${{ matrix.os }} / ghc ${{ matrix.ghc }} + name: ${{ matrix.os }} / GHC ${{ matrix.ghc }} / ${{ matrix.python-version }} runs-on: ${{ matrix.os }} strategy: matrix: include: - - { cabal: "3.14", os: ubuntu-latest, ghc: "9.2.8" } - - { cabal: "3.14", os: ubuntu-latest, ghc: "9.4.8" } - - { cabal: "3.14", os: ubuntu-latest, ghc: "9.6.6" } - - { cabal: "3.14", os: ubuntu-latest, ghc: "9.8.4" } - - { cabal: "3.14", os: ubuntu-latest, ghc: "9.10.2" } - - { cabal: "3.14", os: ubuntu-latest, ghc: "9.12.2" } + - { cabal: "3.14", os: ubuntu-latest, ghc: "9.2.8", python-version: "3.12" } + - { cabal: "3.14", os: ubuntu-latest, ghc: "9.4.8", python-version: "3.12" } + - { cabal: "3.14", os: ubuntu-latest, ghc: "9.6.6", python-version: "3.12" } + - { cabal: "3.14", os: ubuntu-latest, ghc: "9.8.4", python-version: "3.12" } + - { cabal: "3.14", os: ubuntu-latest, ghc: "9.10.2", python-version: "3.12" } + - { cabal: "3.14", os: ubuntu-latest, ghc: "9.12.2", python-version: "3.12" } + # Scan over supported python versions + - { cabal: "3.14", os: ubuntu-latest, ghc: "9.10.2", python-version: "3.9" } + - { cabal: "3.14", os: ubuntu-latest, ghc: "9.10.2", python-version: "3.10" } + - { cabal: "3.14", os: ubuntu-latest, ghc: "9.10.2", python-version: "3.11" } + - { cabal: "3.14", os: ubuntu-latest, ghc: "9.10.2", python-version: "3.12" } + - { cabal: "3.14", os: ubuntu-latest, ghc: "9.10.2", python-version: "3.13" } + - { cabal: "3.14", os: ubuntu-latest, ghc: "9.10.2", python-version: "3.14" } fail-fast: false steps: # ---------------- @@ -35,6 +42,10 @@ jobs: ghc-version: ${{ matrix.ghc }} cabal-version: ${{ matrix.cabal }} # ---------------- + - uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + # ---------------- - uses: actions/cache@v3 name: Cache ~/.cabal/store with: @@ -43,8 +54,9 @@ jobs: # ---------------- - name: Versions run: | - cabal -V - ghc -V + cabal -V + ghc -V + python -V pkg-config python3-embed --cflags pkg-config python3-embed --libs # ---------------- From de333e15cbebb97f5ff7fd5d0c64e6d3a194a38d Mon Sep 17 00:00:00 2001 From: Alexey Khudyakov Date: Mon, 12 Jan 2026 17:01:12 +0300 Subject: [PATCH 2/4] Fix python Bool creation Py_True/False are immortal only since cpython-3.12 before that Py_RETURN_TRUE should be used. --- src/Python/Inline/Literal.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Python/Inline/Literal.hs b/src/Python/Inline/Literal.hs index 39d7a34..a98eff5 100644 --- a/src/Python/Inline/Literal.hs +++ b/src/Python/Inline/Literal.hs @@ -325,8 +325,8 @@ instance FromPy Char where | otherwise -> pure $ chr $ fromIntegral r instance ToPy Bool where - basicToPy True = Py [CU.exp| PyObject* { Py_True } |] - basicToPy False = Py [CU.exp| PyObject* { Py_False } |] + basicToPy True = Py [CU.block| PyObject* { Py_RETURN_TRUE; } |] + basicToPy False = Py [CU.block| PyObject* { Py_RETURN_FALSE; } |] -- | Uses python's truthiness conventions instance FromPy Bool where From a85ce889cdacfe04eb2444fa34b0bac084230c5b Mon Sep 17 00:00:00 2001 From: Alexey Khudyakov Date: Sun, 11 Jan 2026 22:29:00 +0300 Subject: [PATCH 3/4] Require python 3.8 explicitly We need to test old python versions on CI --- ChangeLog.md | 5 ++++- inline-python.cabal | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 5267477..45eb984 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,5 +1,8 @@ -0.2.0.1 [XXX] +0.2.1.0 [XXX] ---------------- +* Python>=3.9 is supported now. Choice is somewhat arbitrary and likely will be + guided by availability of old python versions on github CI in the future. + * Documentation fixes 0.2 [2025.05.04] diff --git a/inline-python.cabal b/inline-python.cabal index 4578c4e..fb7fd62 100644 --- a/inline-python.cabal +++ b/inline-python.cabal @@ -72,7 +72,7 @@ Library include-dirs: include c-sources: cbits/python.c cc-options: -g -Wall - pkgconfig-depends: python3-embed + pkgconfig-depends: python3-embed >= 3.8 -- Exposed-modules: Python.Inline From 04ddbeb3959b87c10624fffa032e3421a7692f65 Mon Sep 17 00:00:00 2001 From: Alexey Khudyakov Date: Mon, 12 Jan 2026 18:21:56 +0300 Subject: [PATCH 4/4] In 3.10 semantics of PyLong_AsLongLong changed Before it accepted floating point number: > Changed in version 3.10: This function will no longer use __int__(). These versions are not supported anymore. Let drop them --- .github/workflows/ci.yml | 1 - ChangeLog.md | 4 ++-- inline-python.cabal | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4c33351..4510eea 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,7 +24,6 @@ jobs: - { cabal: "3.14", os: ubuntu-latest, ghc: "9.10.2", python-version: "3.12" } - { cabal: "3.14", os: ubuntu-latest, ghc: "9.12.2", python-version: "3.12" } # Scan over supported python versions - - { cabal: "3.14", os: ubuntu-latest, ghc: "9.10.2", python-version: "3.9" } - { cabal: "3.14", os: ubuntu-latest, ghc: "9.10.2", python-version: "3.10" } - { cabal: "3.14", os: ubuntu-latest, ghc: "9.10.2", python-version: "3.11" } - { cabal: "3.14", os: ubuntu-latest, ghc: "9.10.2", python-version: "3.12" } diff --git a/ChangeLog.md b/ChangeLog.md index 45eb984..42da1c4 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,7 +1,7 @@ 0.2.1.0 [XXX] ---------------- -* Python>=3.9 is supported now. Choice is somewhat arbitrary and likely will be - guided by availability of old python versions on github CI in the future. +* Only Python>=3.10 is supported now. Earlier versions are not supported anymore. + Now they're tested on CI. * Documentation fixes diff --git a/inline-python.cabal b/inline-python.cabal index fb7fd62..d2998f2 100644 --- a/inline-python.cabal +++ b/inline-python.cabal @@ -72,7 +72,7 @@ Library include-dirs: include c-sources: cbits/python.c cc-options: -g -Wall - pkgconfig-depends: python3-embed >= 3.8 + pkgconfig-depends: python3-embed >= 3.10 -- Exposed-modules: Python.Inline