From c60ff0b11e3e87e6dee75e355eac884efe6a3bd2 Mon Sep 17 00:00:00 2001 From: Marcel Stimberg Date: Wed, 13 Nov 2024 11:37:47 +0100 Subject: [PATCH] Fix compatibility with Cython 3.1 --- brian2/codegen/runtime/cython_rt/extension_manager.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/brian2/codegen/runtime/cython_rt/extension_manager.py b/brian2/codegen/runtime/cython_rt/extension_manager.py index b2a56b2d2..e9d0b22b0 100644 --- a/brian2/codegen/runtime/cython_rt/extension_manager.py +++ b/brian2/codegen/runtime/cython_rt/extension_manager.py @@ -21,7 +21,13 @@ import Cython import Cython.Build as Cython_Build import Cython.Compiler as Cython_Compiler - from Cython.Utils import get_cython_cache_dir as base_cython_cache_dir + + try: + from Cython.Utils import get_cython_cache_dir as base_cython_cache_dir + except ImportError: + from Cython.Build.Cache import ( + get_cython_cache_dir as base_cython_cache_dir, # Cython 3.1, see cython/cython#6090 + ) except ImportError: Cython = None