From 0259b7998d6ee3714ea8c6eae3f9154175fbf97f Mon Sep 17 00:00:00 2001 From: Marcel Stimberg Date: Mon, 4 May 2026 14:27:00 +0200 Subject: [PATCH 1/2] Fix issues in Cython code generation These issues made some GSL tests fail --- brian2/codegen/generators/GSL_generator.py | 9 +-------- brian2/codegen/generators/cython_generator.py | 2 +- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/brian2/codegen/generators/GSL_generator.py b/brian2/codegen/generators/GSL_generator.py index cd9ea2c01..3f7d8d652 100644 --- a/brian2/codegen/generators/GSL_generator.py +++ b/brian2/codegen/generators/GSL_generator.py @@ -1079,20 +1079,13 @@ def unpack_namespace_single(self, var_obj, in_vector, in_scalar): code = [] if isinstance(var_obj, ArrayVariable): array_name = self.generator.get_array_name(var_obj) - dtype = self.c_data_type(var_obj.dtype) if in_vector: - code += [ - f"_GSL_dataholder.{array_name} = <{dtype} *> _buf_{array_name}.data" - ] - if in_scalar: - code += [f"{array_name} = <{dtype} *> _buf_{array_name}.data"] + code += [f"_GSL_dataholder.{array_name} = {array_name}"] else: if in_vector: code += [ f'_GSL_dataholder.{var_obj.name} = _namespace["{var_obj.name}"]' ] - if in_scalar: - code += [f'{var_obj.name} = _namespace["{var_obj.name}"]'] return "\n".join(code) @staticmethod diff --git a/brian2/codegen/generators/cython_generator.py b/brian2/codegen/generators/cython_generator.py index baf6000b3..b66f26061 100644 --- a/brian2/codegen/generators/cython_generator.py +++ b/brian2/codegen/generators/cython_generator.py @@ -440,7 +440,7 @@ def determine_keywords(self): " _buf_{array_name} = _namespace['{array_name}']" ), ( - "cdef {cpp_dtype} * {array_name} = <{cpp_dtype} *>" + "cdef char* {array_name} = " " _buf_{array_name}.data" ), ] From 6627ced1fe09d749fbdc9ca2ff3c09309a512fc5 Mon Sep 17 00:00:00 2001 From: Marcel Stimberg Date: Mon, 4 May 2026 16:31:56 +0200 Subject: [PATCH 2/2] Add runner architecture to Cython cache Not sure this is really helpful, but it should fix the current build error by invalidating earlier caches. --- .github/workflows/testsuite.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/testsuite.yml b/.github/workflows/testsuite.yml index 56388979d..44694d12a 100644 --- a/.github/workflows/testsuite.yml +++ b/.github/workflows/testsuite.yml @@ -127,7 +127,7 @@ jobs: uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1 if: ${{ ! matrix.standalone }} with: - key: cython-extensions-${{ matrix.os.image }}-${{ matrix.python-version }}-32bit-${{ matrix.float_dtype_32 }} + key: cython-extensions-${{ matrix.os.image }}-${{ runner.arch }}-${{ matrix.python-version }}-32bit-${{ matrix.float_dtype_32 }} path: ${{ steps.cython-cache.outputs.cachedir }} - name: Run Tests