We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7faab46 commit d148bddCopy full SHA for d148bdd
vm/src/obj/objfunction.rs
@@ -271,7 +271,7 @@ impl PyFunction {
271
#[derive(Debug)]
272
pub struct PyBoundMethod {
273
// TODO: these shouldn't be public
274
- pub object: PyObjectRef,
+ object: PyObjectRef,
275
pub function: PyObjectRef,
276
}
277
@@ -290,6 +290,14 @@ impl PyBoundMethod {
290
291
#[pyimpl(with(SlotCall))]
292
impl PyBoundMethod {
293
+ #[pymethod(magic)]
294
+ fn repr(&self, vm: &VirtualMachine) -> PyResult<String> {
295
+ Ok(format!(
296
+ "<bound method of {}>",
297
+ vm.to_repr(&self.object)?.as_str()
298
+ ))
299
+ }
300
+
301
#[pymethod(magic)]
302
fn getattribute(&self, name: PyStringRef, vm: &VirtualMachine) -> PyResult {
303
vm.get_attribute(self.function.clone(), name)
0 commit comments