Commit 26895f24 authored by Robert Bradshaw's avatar Robert Bradshaw

Fix vtab member for illegal C names.

--HG--
extra : transplant_source : %0A%92%A3j%B2%1F%CA7%5C%CC%E8%F0%89%21%18%FE%D1%1C%02%92
parent 90354468
...@@ -1854,6 +1854,8 @@ class CClassScope(ClassScope): ...@@ -1854,6 +1854,8 @@ class CClassScope(ClassScope):
error(pos, "Self argument (%s) of C method '%s' does not match parent type (%s)" % error(pos, "Self argument (%s) of C method '%s' does not match parent type (%s)" %
(args[0].type, name, self.parent_type)) (args[0].type, name, self.parent_type))
entry = self.lookup_here(name) entry = self.lookup_here(name)
if cname is None:
cname = c_safe_identifier(name)
if entry: if entry:
if not entry.is_cfunction: if not entry.is_cfunction:
warning(pos, "'%s' redeclared " % name, 0) warning(pos, "'%s' redeclared " % name, 0)
...@@ -1866,7 +1868,7 @@ class CClassScope(ClassScope): ...@@ -1866,7 +1868,7 @@ class CClassScope(ClassScope):
elif type.same_c_signature_as(entry.type, as_cmethod = 1) and type.nogil == entry.type.nogil: elif type.same_c_signature_as(entry.type, as_cmethod = 1) and type.nogil == entry.type.nogil:
pass pass
elif type.compatible_signature_with(entry.type, as_cmethod = 1) and type.nogil == entry.type.nogil: elif type.compatible_signature_with(entry.type, as_cmethod = 1) and type.nogil == entry.type.nogil:
entry = self.add_cfunction(name, type, pos, cname or name, visibility='ignore', modifiers=modifiers) entry = self.add_cfunction(name, type, pos, cname, visibility='ignore', modifiers=modifiers)
defining = 1 defining = 1
else: else:
error(pos, "Signature not compatible with previous declaration") error(pos, "Signature not compatible with previous declaration")
...@@ -1876,7 +1878,7 @@ class CClassScope(ClassScope): ...@@ -1876,7 +1878,7 @@ class CClassScope(ClassScope):
error(pos, error(pos,
"C method '%s' not previously declared in definition part of" "C method '%s' not previously declared in definition part of"
" extension type" % name) " extension type" % name)
entry = self.add_cfunction(name, type, pos, cname or name, entry = self.add_cfunction(name, type, pos, cname,
visibility, modifiers) visibility, modifiers)
if defining: if defining:
entry.func_cname = self.mangle(Naming.func_prefix, name) entry.func_cname = self.mangle(Naming.func_prefix, name)
......
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