Fast path for FOR_ITER specialization.
(&self)
| 669 | impl PyTupleIterator { |
| 670 | /// Fast path for FOR_ITER specialization. |
| 671 | pub(crate) fn fast_next(&self) -> Option<PyObjectRef> { |
| 672 | self.internal |
| 673 | .lock() |
| 674 | .next(|tuple, pos| { |
| 675 | Ok(PyIterReturn::from_result( |
| 676 | tuple.get(pos).cloned().ok_or(None), |
| 677 | )) |
| 678 | }) |
| 679 | .ok() |
| 680 | .and_then(|r| match r { |
| 681 | PyIterReturn::Return(v) => Some(v), |
| 682 | PyIterReturn::StopIteration(_) => None, |
| 683 | }) |
| 684 | } |
| 685 | } |
| 686 | |
| 687 | impl SelfIter for PyTupleIterator {} |