Skip to content

Commit

Permalink
Add __repr__ to the SysinspectReturn
Browse files Browse the repository at this point in the history
  • Loading branch information
isbm committed Nov 26, 2024
1 parent 89ade4c commit 16d86cf
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions libsysinspect/src/pylang/pylib/pysystem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,15 @@ pub mod syscore {
fn set_data(&self, data: PyRef<PyDict>) {
self.inner.lock().data = data;
}

#[pymethod(name = "__repr__")]
fn str(this: PyObjectRef, _vm: &VirtualMachine) -> String {
if let Some(x) = this.downcast_ref::<SysinspectReturn>() {
return format!("<SysinspectReturn: {:?}>", x);
}

"".to_string()
}
}

#[pyfunction]
Expand Down

0 comments on commit 16d86cf

Please sign in to comment.