Commit 968404a1 authored by Mark Florisson's avatar Mark Florisson

Synthesize fused specializations only once

parent 50241a06
......@@ -748,7 +748,7 @@ class FusedCFuncDefNode(StatListNode):
code.mark_pos(stat.pos)
if isinstance(stat, ExprNodes.ExprNode):
stat.generate_evaluation_code(code)
elif not isinstance(stat, FuncDefNode) or stat.entry.used:
elif not isinstance(stat, FuncDefNode): # or stat.entry.used:
stat.generate_execution_code(code)
if self.__signatures__:
......
......@@ -8,6 +8,7 @@ by Cython.
import os
import sys
import imp
import shutil
import pyximport
......@@ -33,3 +34,5 @@ def importer(modulename, version=None):
exec open(filename).read() in mod.__dict__, mod.__dict__
sys.modules[modulename] = mod
return mod
#shutil.copy(filename, os.path.splitext(filename)[0] + '.py')
#return __import__(modulename, None, None, [''])
......@@ -2630,7 +2630,7 @@ class DefNode(FuncDefNode):
decorator.decorator.analyse_expressions(env)
def needs_assignment_synthesis(self, env, code=None):
if self.is_wrapper or self.specialized_cpdefs:
if self.is_wrapper or self.specialized_cpdefs or self.entry.is_fused_specialized:
return False
if self.is_staticmethod:
return True
......
......@@ -2608,6 +2608,7 @@ def specialize_entry(entry, cname):
"""
Specialize an entry of a copied fused function or method
"""
entry.is_fused_specialized = True
entry.name = get_fused_cname(cname, entry.name)
if entry.is_cmethod:
......
......@@ -121,6 +121,8 @@ class Entry(object):
# error_on_uninitialized Have Control Flow issue an error when this entry is
# used uninitialized
# cf_used boolean Entry is used
# is_fused_specialized boolean Whether this entry of a cdef or def function
# is a specialization
# TODO: utility_code and utility_code_definition serves the same purpose...
......@@ -180,6 +182,7 @@ class Entry(object):
prev_entry = None
might_overflow = 0
fused_cfunction = None
is_fused_specialized = False
utility_code_definition = None
in_with_gil_block = 0
from_cython_utility_code = None
......
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