Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Lib/test/test_decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,6 @@ def bar(): return 42
self.assertEqual(bar(), 42)
self.assertEqual(actions, expected_actions)

@unittest.expectedFailure # TODO: RUSTPYTHON
def test_bound_function_inside_classmethod(self):
class A:
def foo(self, cls):
Expand Down
7 changes: 1 addition & 6 deletions crates/vm/src/builtins/classmethod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,8 @@ impl GetDescriptor for PyClassMethod {
) -> PyResult {
let (zelf, _obj) = Self::_unwrap(&zelf, obj, vm)?;
let cls = cls.unwrap_or_else(|| _obj.class().to_owned().into());
// Clone and release lock before calling Python code to prevent deadlock
let callable = zelf.callable.lock().clone();
let call_descr_get: PyResult<PyObjectRef> = callable.get_attr("__get__", vm);
match call_descr_get {
Err(_) => Ok(PyBoundMethod::new(cls, callable).into_ref(&vm.ctx).into()),
Ok(call_descr_get) => call_descr_get.call((cls.clone(), cls), vm),
}
Ok(PyBoundMethod::new(cls, callable).into_ref(&vm.ctx).into())
}
}

Expand Down
Loading