for formal_arg, actual_arg in args[expected_nargs:actual_nargs]:
code.putln("%s.%s = %s;" % (
self.opt_arg_struct,
- formal_arg.name,
+ func_type.opt_arg_cname(formal_arg.name),
actual_arg.result_as(formal_arg.type)))
exc_checks = []
if self.type.is_pyobject:
code.putln('if (%s) {' % Naming.optional_args_cname)
for arg in self.args:
if arg.default:
- # FIXME: simple name prefixing doesn't work when
- # argument name mangling is in place
code.putln('if (%s->%sn > %s) {' % (Naming.optional_args_cname, Naming.pyrex_prefix, i))
declarator = arg.declarator
while not hasattr(declarator, 'name'):
declarator = declarator.base
- code.putln('%s = %s->%s;' % (arg.cname, Naming.optional_args_cname, declarator.name))
+ code.putln('%s = %s->%s;' % (arg.cname, Naming.optional_args_cname, self.type.opt_arg_cname(declarator.name)))
i += 1
for _ in range(self.type.optional_arg_count):
code.putln('}')
def signature_cast_string(self):
s = self.declaration_code("(*)", with_calling_convention=False)
return '(%s)' % s
+
+ def opt_arg_cname(self, arg_name):
+ return self.op_arg_struct.base_type.scope.lookup(arg_name).cname
class CFuncTypeArg(object):