Commit 9887d8a7 authored by Marius Wachtler's avatar Marius Wachtler

Add function.func_name

parent d660c034
......@@ -2242,6 +2242,7 @@ void setupRuntime() {
function_cls->giveAttr("func_code", new (pyston_getset_cls) BoxedGetsetDescriptor(functionCode, NULL, NULL));
function_cls->giveAttr("func_defaults",
new (pyston_getset_cls) BoxedGetsetDescriptor(functionDefaults, NULL, NULL));
function_cls->giveAttr("func_name", function_cls->getattr("__name__"));
function_cls->freeze();
builtin_function_or_method_cls->giveAttr(
......
......@@ -12,4 +12,10 @@ def g():
print type(f).__call__(f)
print type(f).__call__(g)
print f.__name__, f.func_name
f.__name__ = "New name"
print f.__name__, f.func_name
f.func_name = "f"
print f.__name__, f.func_name
print bool(f)
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