self.generate_arg_decref(self.star_arg, code)
if self.starstar_arg:
if self.starstar_arg.entry.xdecref_cleanup:
- code.put_var_xdecref(self.starstar_arg.entry)
+ code.put_var_xdecref_clear(self.starstar_arg.entry)
else:
- code.put_var_decref(self.starstar_arg.entry)
+ code.put_var_decref_clear(self.starstar_arg.entry)
code.putln('__Pyx_AddTraceback("%s");' % self.entry.qualified_name)
# The arguments are put into the closure one after the
# other, so when type errors are found, all references in
def generate_arg_xdecref(self, arg, code):
if arg:
- code.put_var_xdecref(arg.entry)
+ code.put_var_xdecref_clear(arg.entry)
def generate_arg_decref(self, arg, code):
if arg:
- code.put_var_decref(arg.entry)
+ code.put_var_decref_clear(arg.entry)
def generate_stararg_copy_code(self, code):
if not self.star_arg:
if self.starstar_arg:
code.putln("")
code.putln("if (unlikely(!%s)) {" % self.star_arg.entry.cname)
- code.put_decref(self.starstar_arg.entry.cname, py_object_type)
+ code.put_decref_clear(self.starstar_arg.entry.cname, py_object_type)
code.putln('return %s;' % self.error_value())
code.putln('}')
else:
--- /dev/null
+
+def outer(int x, *args, **kwargs):
+ """
+ >>> inner = outer(1, 2, a=3)
+ >>> inner()
+ (1, (2,), {'a': 3})
+
+ >>> inner = outer('abc', 2, a=3)
+ Traceback (most recent call last):
+ TypeError: an integer is required
+ """
+ def inner():
+ return x, args, kwargs
+ return inner