diff --git a/Cython/Compiler/FusedNode.py b/Cython/Compiler/FusedNode.py index fa1695c7b10..d2a0b15b593 100644 --- a/Cython/Compiler/FusedNode.py +++ b/Cython/Compiler/FusedNode.py @@ -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) diff --git a/tests/run/cimport_from_pyx.srctree b/tests/run/cimport_from_pyx.srctree index 4a76c7587e5..5f82d835ca3 100644 --- a/tests/run/cimport_from_pyx.srctree +++ b/tests/run/cimport_from_pyx.srctree @@ -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)