Skip to content

BUG: use proper input and output descriptor in array_assign_subscript cast setup#27047

Merged
mattip merged 1 commit into
numpy:mainfrom
ngoldbaum:fix-array-assign-subscript
Jul 26, 2024
Merged

BUG: use proper input and output descriptor in array_assign_subscript cast setup#27047
mattip merged 1 commit into
numpy:mainfrom
ngoldbaum:fix-array-assign-subscript

Conversation

@ngoldbaum

Copy link
Copy Markdown
Member

Fixes #27003.

Probably going to be a long tail of these.

@mattip

mattip commented Jul 26, 2024

Copy link
Copy Markdown
Member

Thanks @ngoldbaum. Should we backport this?

@egesip

egesip commented Jul 26, 2024

Copy link
Copy Markdown

Thanks @ngoldbaum, @mattip. I hope it's not gonna be a long tail of these, as you suspect, but there is still an issue if the r-value is a list:

    a = np.array(['', ''], dtype='T')
    a[[0, 1]] = ['a'*16, 'b'*16]
    print(a)  # getting ['', '']

Note that both a[[0, 1]] = ['a', 'b'] and a[[0, 1]] = np.array(['a'*16, 'b'*16], dtype='T') work (the latter one thanks to the current fix).

And worse, if a has some non-empty values, I get a crash (I am on Windows):

    a = np.array(['a', 'b'], dtype='T')
    a[[0, 1]] = ['a'*16, 'b'*16] # crash

@ngoldbaum ngoldbaum added the 09 - Backport-Candidate PRs tagged should be backported label Jul 26, 2024
@ngoldbaum

Copy link
Copy Markdown
Member Author

@mattip I added the backport label, thanks for the reminder.

@egesip I opened #27053 to track that. Thanks for the report, If you find any more of these please open issues, it's really helpful to get reports like this.

@egesip

egesip commented Jul 26, 2024

Copy link
Copy Markdown

Will do. Thanks a lot for tackling these issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: StringDType: integer indexed assignment does not work for arena strings.

4 participants