Skip to content

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

Description

@egesip

Describe the issue:

When the strings are "allocated" in the arena (len >= 16), assignment through integer indexing does not modify the array.
Curiously, it works with boolean indexing.
Thanks !

Reproduce the code example:

import numpy as np
from numpy.dtypes import StringDType
a = np.array(['a'*16, 'b'*16], dtype=StringDType())
b = np.array(['d'*16, 'e'*16], dtype=StringDType())
a[[0, 1]] = b
print(a) # expecting ['d'*16, 'e'*16], but getting ['a'*16, 'b'*16]
# curiously a[[True, True]] = b works...

Error message:

No response

Python and NumPy Versions:

2.0.1
3.12.4 (tags/v3.12.4:8e8a4ba, Jun 6 2024, 19:30:16) [MSC v.1940 64 bit (AMD64)]

Runtime Environment:

No response

Context for the issue:

No response

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions