Commit 04160be8 authored by Stefan Behnel's avatar Stefan Behnel

only include CythonFunction utility code if it's really used, might be unused...

only include CythonFunction utility code if it's really used, might be unused if .pxd overrides all def functions to cdef
parent ffb006d7
......@@ -6781,14 +6781,7 @@ class PyCFunctionNode(ExprNode, ModuleNameMixin):
def analyse_types(self, env):
if self.binding:
if self.specialized_cpdefs or self.is_specialization:
env.use_utility_code(
UtilityCode.load_cached("FusedFunction", "CythonFunction.c"))
else:
env.use_utility_code(
UtilityCode.load_cached("CythonFunction", "CythonFunction.c"))
self.analyse_default_args(env)
#TODO(craig,haoyu) This should be moved to a better place
self.set_qualified_name(env, self.def_node.name)
return self
......@@ -6888,14 +6881,18 @@ class PyCFunctionNode(ExprNode, ModuleNameMixin):
code.put_gotref(self.py_result())
def generate_cyfunction_code(self, code):
def_node = self.def_node
if self.specialized_cpdefs:
constructor = "__pyx_FusedFunction_NewEx"
def_node = self.specialized_cpdefs[0]
elif self.is_specialization:
else:
def_node = self.def_node
if self.specialized_cpdefs or self.is_specialization:
code.globalstate.use_utility_code(
UtilityCode.load_cached("FusedFunction", "CythonFunction.c"))
constructor = "__pyx_FusedFunction_NewEx"
else:
code.globalstate.use_utility_code(
UtilityCode.load_cached("CythonFunction", "CythonFunction.c"))
constructor = "__Pyx_CyFunction_NewEx"
if self.code_object:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment