Handle the non-integer return of __index__#97
Merged
ncw merged 4 commits intogo-python:masterfrom Oct 1, 2019
Merged
Conversation
Codecov Report
@@ Coverage Diff @@
## master #97 +/- ##
==========================================
+ Coverage 69.64% 69.91% +0.26%
==========================================
Files 60 60
Lines 10810 10817 +7
==========================================
+ Hits 7529 7563 +34
+ Misses 2750 2729 -21
+ Partials 531 525 -6
Continue to review full report at Codecov.
|
Contributor
Author
|
@corona10 |
|
Does this also affect the >>> l = [1,2]
>>> class C:
... def __index__(self):
... return 1
...
>>> l[C()]
2If your change has an influence on this, you could add a test for list, too. |
Generate TypeError when __index__ return non-integer value Fixes go-python#96
When an error occurs, the error is returned and when the value is none the slice's values have a default value.
Add tests for __index__ in list, tuple, string
9ee72dd to
313242b
Compare
Contributor
Author
|
@Tim-St |
|
@HyeockJinKim Looks good, I think it should work now! |
Collaborator
|
That looks great now - thank you :-) |
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.
Generate TypeError when index return non-integer value
Fixes #96