Skip to content

+= operator fails for flex arrays when adding numpy-typed values #1084

@dwpaley

Description

@dwpaley

Example:

$ cat repro.py
import numpy as np
arr1 = np.array([1,2,3], dtype=np.float32)
from scitbx.array_family import flex
arr2 = flex.double(10)
arr2[0] += arr1[0]

$ libtbx.python repro.py
Traceback (most recent call last):
  File "/dev/shm/dwpaley/20250610/modules/repro.py", line 5, in <module>
    arr2[0] += arr1[0]
    ~~~~^^^
TypeError: 'int' object is not iterable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions