Commit 743aab56 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Get func_arg_passing.py working

parent bc72f09e
......@@ -834,7 +834,7 @@ void setupDescr() {
property_cls->giveAttr("__init__", new BoxedFunction(FunctionMetadata::create(
(void*)propertyInit, UNKNOWN, 5, false, false,
ParamNames({ "", "fget", "fset", "fdel", "doc" }, "", "")),
{ NULL, NULL, NULL, NULL }));
{ None, None, None, NULL }));
property_cls->giveAttr("__get__", new BoxedFunction(FunctionMetadata::create((void*)propertyGet, UNKNOWN, 3)));
property_cls->giveAttr("__set__", new BoxedFunction(FunctionMetadata::create((void*)propertySet, UNKNOWN, 3)));
property_cls->giveAttr("__delete__", new BoxedFunction(FunctionMetadata::create((void*)propertyDel, UNKNOWN, 2)));
......
......@@ -4229,7 +4229,6 @@ void rearrangeArgumentsInternal(ParamReceiveSpec paramspec, const ParamNames* pa
}
if (argspec.num_keywords) {
assert(!rewrite_args && "check refcounting");
assert(argspec.num_keywords == keyword_names->size());
RewriterVar::SmallVector r_vars;
......@@ -4242,7 +4241,7 @@ void rearrangeArgumentsInternal(ParamReceiveSpec paramspec, const ParamNames* pa
if (i == 2)
r_vars.push_back(rewrite_args->arg3);
if (i >= 3)
r_vars.push_back(rewrite_args->args->getAttr((i - 3) * sizeof(Box*)));
r_vars.push_back(rewrite_args->args->getAttr((i - 3) * sizeof(Box*))->setType(RefType::BORROWED));
}
}
......
......@@ -1630,7 +1630,7 @@ static void functionSetDefaults(Box* b, Box* v, void*) {
BoxedTuple* t = static_cast<BoxedTuple*>(v);
auto old_defaults = func->defaults;
func->defaults = incref(t);
func->defaults = xincref(t); // t can be NULL for 'del f.func_defaults'
Py_XDECREF(old_defaults);
func->dependent_ics.invalidateAll();
}
......
# expected: reffail
def f():
def f1(a, b, c):
print a, b, c
......@@ -51,3 +50,7 @@ g()
del f2.func_defaults
g()
g()
def f4(a, b, c, d, e):
print a, b, c, d, e
f4(a=1, b=2, c=3, d=4, e=5)
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