mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 18:59:04 +08:00
Add classmethod.__func__
This commit is contained in:
1 parent
b720681c7b
commit
7564833b6e
2 files changed
+8
No files matched your search
@@ -152,3 +152,6 @@ class T4:
|
||||
|
||||
assert T4.__doc__ == "test4"
|
||||
assert T4.t1.__doc__ == "t1"
|
||||
|
||||
cm = classmethod(lambda cls: cls)
|
||||
assert cm.__func__(int) is int
|
||||
@@ -57,6 +57,11 @@ impl PyClassMethod {
|
||||
.ctx
|
||||
.new_bound_method(self.callable.clone(), owner.clone()))
|
||||
}
|
||||
|
||||
#[pyproperty(name = "__func__")]
|
||||
fn func(&self, _vm: &VirtualMachine) -> PyObjectRef {
|
||||
self.callable.clone()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn init(context: &PyContext) {
|
||||
|
||||
Reference in new issue
Block a user