Skip to content

Commit f5c1596

Browse files
committed
PyCFunction_GET_SELF
1 parent 64cff17 commit f5c1596

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

‎vm/src/builtins/builtin_func.rs‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,14 @@ impl PyNativeFunction {
4949
)
5050
}
5151

52+
// PyCFunction_GET_SELF
53+
pub fn get_self(&self) -> Option<&PyObjectRef> {
54+
if self.value.flags.contains(PyMethodFlags::STATIC) {
55+
return None;
56+
}
57+
self.zelf.as_ref()
58+
}
59+
5260
pub fn as_func(&self) -> &'static dyn PyNativeFn {
5361
self.value.func
5462
}

0 commit comments

Comments
 (0)