Commit 59b04431 authored by Stefan Behnel's avatar Stefan Behnel Committed by GitHub

Avoid creating unused "__defaults__" getter functions for fused dispatch function. (GH-3491)

Closes GH-3481.
parent f364d6dd
......@@ -9279,7 +9279,8 @@ class PyCFunctionNode(ExprNode, ModuleNameMixin):
value=arg.default)
for arg in default_kwargs])
self.defaults_kwdict = defaults_kwdict.analyse_types(env)
else:
elif not self.specialized_cpdefs:
# Fused dispatch functions do not support (dynamic) default arguments, only the specialisations do.
if default_args:
defaults_tuple = DefaultsTupleNode(
self.pos, default_args, self.defaults_struct)
......@@ -9440,8 +9441,7 @@ class PyCFunctionNode(ExprNode, ModuleNameMixin):
if self.defaults_kwdict:
code.putln('__Pyx_CyFunction_SetDefaultsKwDict(%s, %s);' % (
self.result(), self.defaults_kwdict.py_result()))
if def_node.defaults_getter and not self.specialized_cpdefs:
# Fused functions do not support dynamic defaults, only their specialisations can have them for now.
if def_node.defaults_getter:
code.putln('__Pyx_CyFunction_SetDefaultsGetter(%s, %s);' % (
self.result(), def_node.defaults_getter.entry.pyfunc_cname))
if self.annotations_dict:
......
......@@ -640,7 +640,7 @@ class FusedCFuncDefNode(StatListNode):
pyx_code.put_chunk(
u"""
def __pyx_fused_cpdef(signatures, args, kwargs, defaults, *, _fused_sigindex={}):
def __pyx_fused_cpdef(signatures, args, kwargs, defaults, _fused_sigindex={}):
# FIXME: use a typed signature - currently fails badly because
# default arguments inherit the types we specify here!
......
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