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 7411019Copy full SHA for 7411019
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,11 @@ impl PyBoundMethod {
290
291
#[pyimpl(with(SlotCall))]
292
impl PyBoundMethod {
293
+ #[pymethod(magic)]
294
+ fn repr(&self, vm: &VirtualMachine) -> PyResult<String> {
295
+ Ok(format!("<bound method of {}>", vm.to_repr(&self.object)?.as_str()))
296
+ }
297
+
298
#[pymethod(magic)]
299
fn getattribute(&self, name: PyStringRef, vm: &VirtualMachine) -> PyResult {
300
vm.get_attribute(self.function.clone(), name)
0 commit comments