mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-29 03:04:38 +08:00
Return subclass on copy.
This commit is contained in:
1 parent
d6dc0957df
commit
2b5251a4ec
2 files changed
+6
-7
No files matched your search
@@ -833,8 +833,6 @@ class TestSubclass(unittest.TestCase):
|
||||
d.clear()
|
||||
self.assertEqual(len(d), 0)
|
||||
|
||||
# TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure
|
||||
def test_copy_pickle(self):
|
||||
|
||||
d = Deque('abc')
|
||||
|
||||
@@ -174,12 +174,13 @@ mod _collections {
|
||||
|
||||
#[pymethod(magic)]
|
||||
#[pymethod]
|
||||
fn copy(&self) -> Self {
|
||||
PyDeque {
|
||||
deque: PyRwLock::new(self.borrow_deque().clone()),
|
||||
maxlen: self.maxlen,
|
||||
state: AtomicCell::new(self.state.load()),
|
||||
fn copy(zelf: PyRef<Self>, vm: &VirtualMachine) -> PyResult<PyRef<Self>> {
|
||||
Self {
|
||||
deque: PyRwLock::new(zelf.borrow_deque().clone()),
|
||||
maxlen: zelf.maxlen,
|
||||
state: AtomicCell::new(zelf.state.load()),
|
||||
}
|
||||
.into_ref_with_type(vm, zelf.clone_class())
|
||||
}
|
||||
|
||||
#[pymethod]
|
||||
|
||||
Reference in new issue
Block a user