| 1099 | } |
| 1100 | |
| 1101 | fn array_eq(&self, other: &Self, vm: &VirtualMachine) -> PyResult<bool> { |
| 1102 | // we cannot use zelf.is(other) for shortcut because if we contenting a |
| 1103 | // float value NaN we always return False even they are the same object. |
| 1104 | if self.__len__() != other.__len__() { |
| 1105 | return Ok(false); |
| 1106 | } |
| 1107 | let array_a = self.read(); |
| 1108 | let array_b = other.read(); |
| 1109 | |
| 1110 | // fast path for same ArrayContentType type |
| 1111 | if let Ok(ord) = array_a.cmp(&array_b) { |
| 1112 | return Ok(ord == Some(Ordering::Equal)); |
| 1113 | } |
| 1114 | |
| 1115 | let iter = Iterator::zip(array_a.iter(vm), array_b.iter(vm)); |
| 1116 | |
| 1117 | for (a, b) in iter { |
| 1118 | if !vm.bool_eq(&*a?, &*b?)? { |
| 1119 | return Ok(false); |
| 1120 | } |
| 1121 | } |
| 1122 | Ok(true) |
| 1123 | } |
| 1124 | |
| 1125 | #[pymethod] |
| 1126 | fn __reduce_ex__( |