diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ada2439..af0017d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,13 +18,14 @@ env: jobs: build: - name: Build + name: Build (${{ matrix.platform }}, Go ${{ matrix.go-version }}, Python ${{ matrix.python-version }}) strategy: fail-fast: false matrix: # TODO: Consider official support matrix (OS and Go versions) and adjust this matrix accordingly go-version: [1.25.x, 1.24.x, 1.23.x, 1.22.x] platform: [ubuntu-latest, windows-latest, macos-15] + python-version: ['3.11', '3.12'] runs-on: ${{ matrix.platform }} steps: - name: Checkout code @@ -33,7 +34,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version: '3.11' + python-version: ${{ matrix.python-version }} - name: Install Go uses: actions/setup-go@v5 diff --git a/bind/gen.go b/bind/gen.go index f6d8604..fe96bd6 100644 --- a/bind/gen.go +++ b/bind/gen.go @@ -194,7 +194,10 @@ func boolPyToGo(b C.char) bool { } func complex64GoToPy(c complex64) *C.PyObject { - return C.PyComplex_FromDoubles(C.double(real(c)), C.double(imag(c))) + gstate := C.PyGILState_Ensure() + obj := C.PyComplex_FromDoubles(C.double(real(c)), C.double(imag(c))) + C.PyGILState_Release(gstate) + return obj } func complex64PyToGo(o *C.PyObject) complex64 { @@ -203,7 +206,10 @@ func complex64PyToGo(o *C.PyObject) complex64 { } func complex128GoToPy(c complex128) *C.PyObject { - return C.PyComplex_FromDoubles(C.double(real(c)), C.double(imag(c))) + gstate := C.PyGILState_Ensure() + obj := C.PyComplex_FromDoubles(C.double(real(c)), C.double(imag(c))) + C.PyGILState_Release(gstate) + return obj } func complex128PyToGo(o *C.PyObject) complex128 {