From 9abfe020a45d5737b744602490a5566ca738fbc4 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Wed, 3 Nov 2010 21:24:09 +0100 Subject: [PATCH] make sure the cname really is unique when overriding its signature --- Cython/Compiler/Symtab.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Cython/Compiler/Symtab.py b/Cython/Compiler/Symtab.py index 8f176c8e..fb84b836 100644 --- a/Cython/Compiler/Symtab.py +++ b/Cython/Compiler/Symtab.py @@ -552,7 +552,18 @@ class Scope(object): warning(pos, "Function '%s' previously declared as '%s'" % (name, entry.visibility), 1) if not entry.type.same_as(type): if visibility == 'extern' and entry.visibility == 'extern': - if self.is_cpp() or (cname and entry.cname and cname != entry.cname): + can_override = False + if self.is_cpp(): + can_override = True + elif cname: + # if all alternatives have different cnames, + # it's safe to allow signature overrides + for alt_entry in entry.all_alternatives(): + if not alt_entry.cname or cname == alt_entry.cname: + break # cname not unique! + else: + can_override = True + if can_override: temp = self.add_cfunction(name, type, pos, cname, visibility, modifiers) temp.overloaded_alternatives = entry.all_alternatives() entry = temp -- 2.26.2