Commit 8e739ffc authored by Kevin Modzelewski's avatar Kevin Modzelewski Committed by Kevin Modzelewski

Add default arg for 'owner' in function.__get__

parent 4e10a4f0
...@@ -4539,8 +4539,9 @@ void setupRuntime() { ...@@ -4539,8 +4539,9 @@ void setupRuntime() {
function_cls->giveAttrMember("__doc__", T_OBJECT, offsetof(BoxedFunction, doc), false); function_cls->giveAttrMember("__doc__", T_OBJECT, offsetof(BoxedFunction, doc), false);
function_cls->giveAttrBorrowed("func_doc", function_cls->getattr(getStaticString("__doc__"))); function_cls->giveAttrBorrowed("func_doc", function_cls->getattr(getStaticString("__doc__")));
function_cls->giveAttrDescriptor("__globals__", function_globals, NULL); function_cls->giveAttrDescriptor("__globals__", function_globals, NULL);
function_cls->giveAttr("__get__", function_cls->giveAttr(
new BoxedFunction(BoxedCode::create((void*)functionGet, UNKNOWN, 3, "function.__get__"))); "__get__",
new BoxedFunction(BoxedCode::create((void*)functionGet, UNKNOWN, 3, "function.__get__"), { Py_None }));
function_cls->giveAttr("__call__", new BoxedFunction(BoxedCode::create((void*)functionCall, UNKNOWN, 1, true, true, function_cls->giveAttr("__call__", new BoxedFunction(BoxedCode::create((void*)functionCall, UNKNOWN, 1, true, true,
"function.__call__"))); "function.__call__")));
function_cls->giveAttr("__nonzero__", new BoxedFunction(BoxedCode::create((void*)functionNonzero, BOXED_BOOL, 1, function_cls->giveAttr("__nonzero__", new BoxedFunction(BoxedCode::create((void*)functionNonzero, BOXED_BOOL, 1,
......
...@@ -113,3 +113,26 @@ def f(): ...@@ -113,3 +113,26 @@ def f():
pass pass
""" in globals() """ in globals()
assert type(globals()['f'].__globals__) == type(globals()) assert type(globals()['f'].__globals__) == type(globals())
def f(self):
pass
class C(object):
pass
c = C()
import re
def s(o):
return re.sub('0x[0-9a-f]+', '', str(o))
print s(f.__get__(c))
print s(f.__get__(c, C))
print s(f.__get__(c, c))
print f.__get__(c)()
print f.__get__(c, C)()
print f.__get__(c, None)()
print f.__get__(c, c)()
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