mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-09 22:49:57 +09:00
Merge pull request #2981 from DimitrisJim/deque_subclass_copy
Return subclass on deque copy.
This commit is contained in:
@@ -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