Skip to content

BUG: Fixes ndarray.fill to accept maximum uint64 value - #5618

Merged
juliantaylor merged 1 commit into
numpy:masterfrom
johntyree:arrfill_ulonglong
Mar 1, 2015
Merged

juliantaylor merged 1 commit into
numpy:masterfrom
johntyree:arrfill_ulonglong

Conversation

@johntyree

Copy link
Copy Markdown
Contributor

This PR changes np.ndarray.fill to attempt to convert to uint64 if its argument is a Python integer and conversion toint64 fails.

np.ndarray.fill now accepts the Python long 2**64 - 1 as a value. Previously it failed because the value overflows an int64 and uint64 was not attempted. Constructing the value as a uint64 manually and then passing it to fill succeeded.

Fixes #5612

Comment thread numpy/core/src/multiarray/convert.c Outdated

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not particularly happy with the nesting here, but this case is slightly different from the others in that we're mapping from a single Python type to one of several NumPy types. Suggestions welcome.

@juliantaylor

Copy link
Copy Markdown
Contributor

looks good thanks
can you still squash the commits into one with git rebase -i master
as its probably still appropriate for 1.9.2 please also run git rebase --onto $(git merge-base master origin/maintenance/1.9.x) HEAD^ assuming origin is the remote name of the main numpy repo.

@johntyree
johntyree force-pushed the arrfill_ulonglong branch from f8f5d96 to 11dfe93 Compare March 1, 2015 00:14
@johntyree

Copy link
Copy Markdown
Contributor Author

So I think I understood you correctly. There is now a single commit based off of 50afb0f.

@juliantaylor

Copy link
Copy Markdown
Contributor

perfect, that allows us to easily merge it into both branches.
thanks

juliantaylor added a commit that referenced this pull request Mar 1, 2015
BUG: Fixes ndarray.fill to accept maximum uint64 value
@juliantaylor
juliantaylor merged commit a29f50e into numpy:master Mar 1, 2015
juliantaylor added a commit that referenced this pull request Mar 1, 2015
BUG: Fixes ndarray.fill to accept maximum uint64 value
@johntyree

Copy link
Copy Markdown
Contributor Author

\o/ Thanks

@johntyree
johntyree deleted the arrfill_ulonglong branch March 1, 2015 01:14
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.

Python long raises OverflowError while same value as np.uint64 does not.

2 participants