Skip to content

Commit

Permalink
Fix issue with cpdef functions and cimport_from_pyx
Browse files Browse the repository at this point in the history
  • Loading branch information
da-woods committed Nov 4, 2023
1 parent edaea23 commit f4a7f74
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 3 additions & 2 deletions Cython/Compiler/FusedNode.py
Expand Up @@ -958,8 +958,9 @@ def generate_function_definitions(self, env, code):

from . import Options
for stat in self.stats:
from_pyx = Options.cimport_from_pyx and not stat.entry.visibility == 'extern'
if isinstance(stat, FuncDefNode) and (stat.entry.used or from_pyx):
if isinstance(stat, FuncDefNode) and (
stat.entry.used or
(Options.cimport_from_pyx and not stat.entry.visibility == 'extern')):
code.mark_pos(stat.pos)
stat.generate_function_definitions(env, code)

Expand Down
5 changes: 4 additions & 1 deletion tests/run/cimport_from_pyx.srctree
Expand Up @@ -96,5 +96,8 @@ cdef fused_checker(fused_type i):
else:
return False

cpdef fused_cpdef(fused_type i):
return not fused_checker(i)

def test():
return fused_checker(0)
return fused_checker(0) and fused_cpdef(1.0)

0 comments on commit f4a7f74

Please sign in to comment.