Repository: cython/cython

Issue:
[BUG] SciPy failure to build with Cython 3.0.3 (bisected)
### Describe the bug

SciPy `main` cannot build with Cython `3.0.3` and I bisected on Cython commits:

```
401e880a336576b765e5d6bb1a9718947243d92b is the first bad commit
commit 401e880a336576b765e5d6bb1a9718947243d92b
Author: da-woods <dw-git@d-woods.co.uk>
Date:   Fri Sep 29 11:11:22 2023 +0100

    Show performance hints for nogil functions requiring exception checks (GH-5673)
    
    Performance hints come out similar to warnings but do not make `-Werror` fail.

 Cython/Compiler/Errors.py       | 14 +++++++++
 Cython/Compiler/ExprNodes.py    |  7 +++--
 Cython/Compiler/Nodes.py        |  3 +-
 Cython/Compiler/Options.py      |  4 +++
 Cython/Compiler/PyrexTypes.py   | 13 ++++++++-
 Cython/Compiler/Scanning.py     |  1 +
 Cython/Compiler/Symtab.py       | 12 ++++++++
 Cython/Compiler/TreeFragment.py |  8 +++++-
 Cython/Compiler/UtilityCode.py  |  3 +-
 runtests.py                     | 64 +++++++++++++++++++++++++----------------
 tests/run/nogil.pxd             |  1 +
 tests/run/nogil.pyx             | 39 ++++++++++++++++++++++++-
 tests/run/nogil_other.pxd       |  2 ++
 13 files changed, 138 insertions(+), 33 deletions(-)
 create mode 100644 tests/run/nogil.pxd
 create mode 100644 tests/run/nogil_other.pxd
```

This appears to be slightly different than gh-5747 from `pandas`, though perhaps some similarity.

### Code to reproduce the behaviour:

_No response_

### Expected behaviour

_No response_

### OS

_No response_

### Python version

_No response_

### Cython version

_No response_

### Additional context

_No response_


Discussion:
Sample failure log: https://github.com/scipy/scipy/actions/runs/6422201150/job/17438217924?pr=19350
Errors as reported in https://github.com/cython/cython/issues/5747:
```
  pandas/_libs/tslibs/nattype.cpython-310-aarch64-linux-gnu.so.p/pandas/_libs/tslibs/nattype.pyx.c:8729:26: error: static declaration of ‘__pyx_f_6pandas_5_libs_6tslibs_4util_is_timedelta64_object’ follows non-static declaration
   8729 | static CYTHON_INLINE int __pyx_f_6pandas_5_libs_6tslibs_4util_is_timedelta64_object(PyObject *__pyx_v_obj) {
        |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  pandas/_libs/tslibs/nattype.cpython-310-aarch64-linux-gnu.so.p/pandas/_libs/tslibs/nattype.pyx.c:8492:17: note: previous implicit declaration of ‘__pyx_f_6pandas_5_libs_6tslibs_4util_is_timedelta64_object’ was here
   8492 |   __pyx_t_2 = (!__pyx_f_6pandas_5_libs_6tslibs_4util_is_timedelta64_object(__pyx_v_obj));
```

Bug was introduced in the pxd related changes in https://github.com/cython/cython/commit/401e880a336576b765e5d6bb1a9718947243d92b (https://github.com/cython/cython/pull/5673)
OK, this is diff between correctly compiled `_ufunc.pyx` file and wrong one:

![image](https://github.com/cython/cython/assets/827060/8b2345ee-4544-42fa-8a82-a85d2cecd1bc)

The issue is that all declarations are missing. It seems that adding back following line makes the diff the same:

https://github.com/cython/cython/pull/5673/files#diff-8789a479ea870f7646251224385afa3ebffe9b6acab136ff55011b31386ddd84L2700

(But I am not sure if it does not break something else, I didn't go deep with investigation)
Or possibly Symtab L917 should be:

```
entry.inline_func_in_pxd = True
```

(To properly replace the line removed from Nodes.py).

Thanks for the further investigation @matusvalo 
> Or possibly Symtab L917 should be:
> 
> ```
> entry.inline_func_in_pxd = True
> ```
> 
> (To properly replace the line removed from Nodes.py).
> 
> Thanks for the further investigation @matusvalo

Yes I confirm. I suppose it was a typo. I tried quickly to create isolated reproducer but I was not lucky. If someone can help with that, I think we can create PR...

Resolving patch:
diff --git a/Cython/Compiler/Symtab.py b/Cython/Compiler/Symtab.py
--- a/Cython/Compiler/Symtab.py
+++ b/Cython/Compiler/Symtab.py
@@ -914,7 +914,7 @@ def declare_cfunction(self, name, type, pos,
             entry.func_cname = cname
             entry.is_overridable = overridable
         if inline_in_pxd:
-            entry.inline_in_pxd = True
+            entry.inline_func_in_pxd = True
         if in_pxd and visibility != 'extern':
             entry.defined_in_pxd = 1
         if api:


Test patch:
diff --git a/tests/run/inlinepxd.pyx b/tests/run/inlinepxd.pyx
--- a/tests/run/inlinepxd.pyx
+++ b/tests/run/inlinepxd.pyx
@@ -42,3 +42,11 @@ def test_wraparound():
     # the wraparound directive from this scope should not affect the inline pxd
     a = [ 0.0, 1.0 ]
     return inlinepxd_support.index(a)
+
+
+def test_call_inlined(L):
+    """
+    >>> test_call_inlined([1, 2, 3])
+    3
+    """
+    return inlinepxd_support.call_index(L)
diff --git a/tests/run/inlinepxd_support.pxd b/tests/run/inlinepxd_support.pxd
--- a/tests/run/inlinepxd_support.pxd
+++ b/tests/run/inlinepxd_support.pxd
@@ -7,3 +7,5 @@ cdef inline index(list L):
     # See https://github.com/cython/cython/issues/1071
     return L[-1]
 
+cdef inline call_index(list L):
+    return index(L)