numpy icon indicating copy to clipboard operation
numpy copied to clipboard

BUG: Fixed Bug #25744 - Raise error for put method on empty array

Open msavinash opened this issue 1 year ago • 1 comments

I've addressed the issue (See #25744) with checks to verify array size is greater than zero when performing put operation and if not, to raise a ValueError with appropriate error message.

I've made the following improvements:

Ensure program does not stay in a loop forever when empty array supplied to put method. Changes done in the built-in C file ensures the program works for both:

import numpy as np

array = np.asarray(list())
np.put(array, 1, 1, mode="wrap")

and

import numpy as np

array = np.asarray(list())
array.put(array, 1, 1, mode="wrap")

msavinash avatar Feb 04 '24 18:02 msavinash

Thanks. Please note that, first, this PR is not reviewable due to automatic code reformatting. And second, that until/unless gh-25760 is stalled for a week or two, I don't think we will focus on this one.

seberg avatar Feb 05 '24 14:02 seberg