FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Handle the non-integer return of __index__ by HyeockJinKim · Pull Request #97 · go-python/gpython · GitHub

Handle the non-integer return of __index__ - #97

Merged
ncw merged 4 commits into
go-python:masterfrom
HyeockJinKim:issue96
Oct 1, 2019
Merged

Handle the non-integer return of __index__#97
ncw merged 4 commits into
go-python:masterfrom
HyeockJinKim:issue96

Conversation

Copy link
Copy Markdown
Contributor

Generate TypeError when index return non-integer value

Fixes #96

codecov-io commented Sep 28, 2019
edited
Loading

Copy link
Copy Markdown

Codecov Report

Merging #97 into master will increase coverage by 0.26%.
The diff coverage is 85.71%.

@@            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
Impacted Files Coverage Δ
py/internal.go 44.13% <100%> (+2.34%) ⬆️
py/range.go 86.66% <84.61%> (-0.68%) ⬇️
py/slice.go 84% <0%> (+2%) ⬆️
py/list.go 50.36% <0%> (+3.64%) ⬆️
py/tuple.go 50.92% <0%> (+11.11%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update af17d7d...313242b. Read the comment docs.

Copy link
Copy Markdown
Contributor Author

@corona10
Can I get a review?

corona10 requested review from corona10 and ncw September 29, 2019 08:34

ghost commented Sep 29, 2019

Copy link
Copy Markdown

Does this also affect the list type?
CPython supports:

>>> l = [1,2]
>>> class C:
...   def __index__(self):
...     return 1
...
>>> l[C()]
2

If 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

Copy link
Copy Markdown
Contributor Author

@Tim-St
This fix affects strings, tuples, and lists.
So I added test code for each one. Would you like to review it again?

ghost commented Sep 29, 2019

Copy link
Copy Markdown

@HyeockJinKim Looks good, I think it should work now!

ncw merged commit 36da816 into go-python:master Oct 1, 2019

ncw commented Oct 1, 2019

Copy link
Copy Markdown
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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Handle the return of non-integer value in __index__ function

3 participants


Back | FazBrowse Home | New Git URL