mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-02 19:39:49 +09:00
implement hashable and unhashable for collections.deque
This commit is contained in:
@@ -5,7 +5,7 @@ mod _collections {
|
||||
use crate::builtins::pytype::PyTypeRef;
|
||||
use crate::common::lock::{PyRwLock, PyRwLockReadGuard, PyRwLockWriteGuard};
|
||||
use crate::function::OptionalArg;
|
||||
use crate::slots::{Comparable, Iterable, PyComparisonOp, PyIter};
|
||||
use crate::slots::{Comparable, Hashable, Iterable, PyComparisonOp, PyIter, Unhashable};
|
||||
use crate::vm::ReprGuard;
|
||||
use crate::VirtualMachine;
|
||||
use crate::{sequence, sliceable};
|
||||
@@ -64,7 +64,7 @@ mod _collections {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(flags(BASETYPE), with(Comparable, Iterable))]
|
||||
#[pyimpl(flags(BASETYPE), with(Comparable, Hashable, Iterable))]
|
||||
impl PyDeque {
|
||||
#[pyslot]
|
||||
fn tp_new(
|
||||
@@ -340,6 +340,8 @@ mod _collections {
|
||||
}
|
||||
}
|
||||
|
||||
impl Unhashable for PyDeque {}
|
||||
|
||||
impl Iterable for PyDeque {
|
||||
fn iter(zelf: PyRef<Self>, vm: &VirtualMachine) -> PyResult {
|
||||
Ok(PyDequeIterator {
|
||||
|
||||
Reference in New Issue
Block a user