Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #8874
This PR expands CP collections.deque functionality to be more congruent with the CPython implementation by adding iteration, subscription and initialization as well as pop(), appendleft() and extend(). Tests for the new functionality are also provided.
This code is a copy of MP PR #10724 that was coded/submitted by LordFlashmeow and recently merged into MP. I have built and tested versions of CP with this code for RP2040, ESP32S2 and atmel-samd M4 boards and everything compiles and works as expected. I also confirmed that collections.deque is still not included in M0 builds as intended.
As per discussion with tannewt in CP Issue #8874: Deque is not iterable and on the discord circuitpython-dev channel, I am submitting this PR in the hopes the new functionality might be integrated into CP more quickly than the normal MP release / CP upstream merge cycle will take as I am using it for a current project. But if this PR creates more work or headaches, I can certainly wait and keep using a custom version of CP until the functionality is officially integrated.
Last but not least, this is my first PR to a large open-source project so if you have any suggestions or requests for what I can / should do differently please feel free to let me know.