Implement methods for PyReverseSequenceIterator#2911
Merged
Conversation
a73b816 to
ef014f9
Compare
DimitrisJim
requested changes
Aug 19, 2021
ef014f9 to
626618b
Compare
This commit implements `length_hint`, `reduce`, `setstate`, `next` for `PyReverseSequenceIterator`. In previous rustpython, it did not conduct methods well for general object. Signed-off-by: snowapril <sinjihng@gmail.com>
This commit removes `PyStrReverseIterator` and its traits for using general `PyReverseSequenceIterator` for `PyStr` type. In previous rustpython, `PyStrReverseIterator` type registered in `TypeZoo`, even it had no methods(e.g. `length_hint`, `reduce`, `setstate`) Therefore, by removing `PyStrReverseIterator`, `PyStr` enable to use `PySequenceReverseIterator`. Signed-off-by: snowapril <sinjihng@gmail.com>
By implement general PyReverseSequenceIterator and make PyStr to use it, now three tests fixed. Signed-off-by: snowapril <sinjihng@gmail.com>
626618b to
aac16f1
Compare
DimitrisJim
approved these changes
Aug 19, 2021
DimitrisJim
left a comment
Member
There was a problem hiding this comment.
@youknowone pinging you here because remember you had some feedback when I added this type back in #2900. Overall this lgtm.
Member
|
@DimitrisJim yes, I found this PR is solving infinite sub problem, thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This revision includes:
length_hint,reduce,setstateandnextforPyReverseSequenceIteratorPyStrReverseIteratorto makePyStrtype use generalPyReverseSequenceIteratorexpectedFailureannotations intest_enumerate.py,test_tuple.pyBy these changes,
TestReversed.test_len,TestReversed.test_pickleandTupleTest.test_reversed_pickletests became successful now.Also, below python codes are now available by this PR
Before
After
Before
After
Except above example codes, general object that implements required interface can use
PyReverseSequenceIteratorand its methods.