From a181fd5b75f2e05d1b7beafbb48157feaa468941 Mon Sep 17 00:00:00 2001
From: Matus Valo <matusvalo@users.noreply.github.com>
Date: Wed, 3 May 2023 22:22:36 +0200
Subject: [PATCH] MAINT: Allow scipy to be compiled in cython3 (#18242)

- Unpin Cython and use Cython master in the pre-release CI job
- Use absolute instead of relative imports in a few places
- Use `CYTHON_EXTERN_C` for C++ code exposing a C API

[skip ci]
---
 .github/workflows/linux_meson.yml | 5 ++---
 scipy/linalg.pxd                  | 2 +-
 scipy/special.pxd                 | 2 +-
 scipy/special/meson.build         | 2 +-
 4 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/scipy/linalg.pxd b/scipy/linalg.pxd
index 1f656b870..c7c49f9ad 100644
--- a/scipy/linalg.pxd
+++ b/scipy/linalg.pxd
@@ -1 +1 @@
-from .linalg cimport cython_blas, cython_lapack
+from scipy.linalg cimport cython_blas, cython_lapack
diff --git a/scipy/special.pxd b/scipy/special.pxd
index 62cb82807..1daa9fb37 100644
--- a/scipy/special.pxd
+++ b/scipy/special.pxd
@@ -1 +1 @@
-from .special cimport cython_special
+from scipy.special cimport cython_special
diff --git a/scipy/special/meson.build b/scipy/special/meson.build
index 334f87943..e7e25aa54 100644
--- a/scipy/special/meson.build
+++ b/scipy/special/meson.build
@@ -371,7 +371,7 @@ py3.extension_module('_ufuncs_cxx',
   [ufuncs_cxx_sources,
     uf_cython_gen_cpp.process(cython_special[2]),  # _ufuncs_cxx.pyx
     ],
-  cpp_args: cython_cpp_args,
+  cpp_args: [cython_cpp_args, '-DCYTHON_EXTERN_C=extern "C"'],
   include_directories: [inc_np, '../_lib/boost', '../_lib',
                         '../_build_utils/src'],
   link_args: version_link_args,
-- 
2.23.0

