Commit 33ac174e authored by Kevin Modzelewski's avatar Kevin Modzelewski

Support staticmethod.__func__

parent d43ea30f
...@@ -608,6 +608,7 @@ void setupDescr() { ...@@ -608,6 +608,7 @@ void setupDescr() {
property_cls->giveAttrMember("__doc__", T_OBJECT, offsetof(BoxedProperty, prop_doc)); property_cls->giveAttrMember("__doc__", T_OBJECT, offsetof(BoxedProperty, prop_doc));
property_cls->freeze(); property_cls->freeze();
staticmethod_cls->giveAttrMember("__func__", T_OBJECT, offsetof(BoxedStaticmethod, sm_callable));
staticmethod_cls->giveAttr( staticmethod_cls->giveAttr(
"__init__", new BoxedFunction(FunctionMetadata::create((void*)staticmethodInit, UNKNOWN, 5, false, false), "__init__", new BoxedFunction(FunctionMetadata::create((void*)staticmethodInit, UNKNOWN, 5, false, false),
{ None, None, None, None })); { None, None, None, None }));
...@@ -617,6 +618,7 @@ void setupDescr() { ...@@ -617,6 +618,7 @@ void setupDescr() {
staticmethod_cls->freeze(); staticmethod_cls->freeze();
classmethod_cls->giveAttrMember("__func__", T_OBJECT, offsetof(BoxedClassmethod, cm_callable));
classmethod_cls->giveAttr( classmethod_cls->giveAttr(
"__init__", new BoxedFunction(FunctionMetadata::create((void*)classmethodInit, UNKNOWN, 5, false, false), "__init__", new BoxedFunction(FunctionMetadata::create((void*)classmethodInit, UNKNOWN, 5, false, false),
{ None, None, None, None })); { None, None, None, None }));
......
...@@ -11,6 +11,11 @@ c = C() ...@@ -11,6 +11,11 @@ c = C()
c.f(1, 2, 3, 4) c.f(1, 2, 3, 4)
c.g(5, 6, 7, 8) c.g(5, 6, 7, 8)
assert C.__dict__['f'].__func__ is C.f
assert C.__dict__['g'].__func__ is C.g.im_func
c.f.__call__(1, 2, 3, 4)
c.g.__call__(5, 6, 7, 8)
C.f(9, 10, 11, 12) C.f(9, 10, 11, 12)
C.f(13, 14, 15, 16) C.f(13, 14, 15, 16)
......
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