diff --git a/Lib/test/test_copy.py b/Lib/test/test_copy.py index abc82aea3..d7dae8ef7 100644 --- a/Lib/test/test_copy.py +++ b/Lib/test/test_copy.py @@ -887,8 +887,6 @@ class TestCopy(unittest.TestCase): del d self.assertEqual(len(v), 1) - # TODO: RUSTPYTHON - @unittest.expectedFailure def test_deepcopy_bound_method(self): class Foo(object): def m(self): diff --git a/Lib/test/test_functools.py b/Lib/test/test_functools.py index b961610aa..59b286b3f 100644 --- a/Lib/test/test_functools.py +++ b/Lib/test/test_functools.py @@ -543,8 +543,6 @@ class TestPartialMethod(unittest.TestCase): self.assertEqual(self.A.over_partial(self.a, 5, d=8), ((self.a, 7, 5), {'c': 6, 'd': 8})) - # TODO: RUSTPYTHON - @unittest.expectedFailure def test_bound_method_introspection(self): obj = self.a self.assertIs(obj.both.__self__, obj) diff --git a/Lib/test/test_tokenize.py b/Lib/test/test_tokenize.py index 1d1ed4538..9c185c2e6 100644 --- a/Lib/test/test_tokenize.py +++ b/Lib/test/test_tokenize.py @@ -1325,8 +1325,6 @@ class TestDetectEncoding(TestCase): self.assertEqual(fp.encoding, 'utf-8-sig') self.assertEqual(fp.mode, 'r') - # TODO: RUSTPYTHON - @unittest.expectedFailure def test_filename_in_exception(self): # When possible, include the file name in the exception. path = 'some_file_path' diff --git a/vm/src/builtins/function.rs b/vm/src/builtins/function.rs index d326f4f99..171db5880 100644 --- a/vm/src/builtins/function.rs +++ b/vm/src/builtins/function.rs @@ -473,6 +473,11 @@ impl PyBoundMethod { self.function.clone() } + #[pyproperty(name = "__self__")] + fn get_self(&self) -> PyObjectRef { + self.object.clone() + } + #[pyproperty(magic)] fn module(&self, vm: &VirtualMachine) -> Option { vm.get_attribute(self.function.clone(), "__module__").ok()