Skip to content

BUG: Fix segfault in random.permutation(x) when x is a string. #14330

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 22, 2019

Conversation

charris
Copy link
Member

@charris charris commented Aug 22, 2019

Backport of #14241.

Reference #14238

I made the assumption that anyone who passes a string x to the function np.random.permutation(x) most likely intend to shuffle the string in question. I suggest that if this isn't the desired behaviour, then I can flag an error instead of the segfault.

  • fixing segfault error in np.random.permutation(x) where x is str

  • removed whitespace

  • changing error type to ValueError

  • changing error type to ValueError

  • changing error type to ValueError

  • tests

  • changed error to IndexError for backward compatibility with numpy 1.16

  • fixes numpy.randomstate.permutation segfault too

  • Rolled back to ValueError for Generator.permutation() for all 0-dimensional

  • fixes refuige erro and rolls backs to AxisError

…py#14241)

* fixing segfault error in np.random.permutation(x) where x is str

* removed whitespace

* changing error type to ValueError

* changing error type to ValueError

* changing error type to ValueError

* tests

* changed error to IndexError for backward compatibility with numpy 1.16

* fixes numpy.randomstate.permutation segfault too

* Rolled back to ValueError for Generator.permutation() for all 0-dimensional

* fixes refuige erro and rolls backs to AxisError
@charris charris added this to the 1.17.1 release milestone Aug 22, 2019
@charris charris merged commit fa64aba into numpy:maintenance/1.17.x Aug 22, 2019
@charris charris deleted the backport-14241 branch August 23, 2019 02:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants