From e003f255d5735e79995db836cd8fcd75da357918 Mon Sep 17 00:00:00 2001 From: James Webber Date: Sun, 8 Aug 2021 20:59:39 -0400 Subject: [PATCH] implement hashable and unhashable for collections.deque --- vm/src/stdlib/collections.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/vm/src/stdlib/collections.rs b/vm/src/stdlib/collections.rs index 373bef6a6..3a814fdb7 100644 --- a/vm/src/stdlib/collections.rs +++ b/vm/src/stdlib/collections.rs @@ -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, vm: &VirtualMachine) -> PyResult { Ok(PyDequeIterator {