Skip to content

np.place segfaults for quaddtype #7

Open

Description

@juntyr
import numpy as np
from numpy_quaddtype import QuadPrecDType

a = np.zeros((18, 1), dtype=QuadPrecDType())
m = np.zeros((18, 1), dtype=np.bool)
m[3:-3] = True
v = np.ones(12, dtype=QuadPrecDType())

np.place(a, m, v)

print(a, m, v)

never reaches the print in numpy-quaddtype==0.2.0.

@SwayamInSync has this been fixed since?

Activity

  1. SwayamInSync commented on Dec 1, 2025

    @SwayamInSync
    Member

    This requires the implementation of copyswap otherwise if urgent then a similar operation np.copyto(arr, vals, where=mask) works

  2. SwayamInSync commented on Dec 1, 2025

    @SwayamInSync
    Member

    @seberg just a heads up on another function that relies on copyswap
    and inside dtypemeta.c it assigns NULL to that function pointer leading to segfault

  3. added theissue type on Dec 1, 2025
  4. juntyr commented on Dec 1, 2025

    @juntyr
    ContributorAuthor

    This requires the implementation of copyswap otherwise if urgent then a similar operation np.copyto(arr, vals, where=mask) works

    np.copyto is unfortunately not the right workaround since np.place takes a flat differently sized vals array. However, np.put(arr, np.flatnonzero(mask), vals) seems to work

  5. juntyr commented on Dec 1, 2025

    @juntyr
    ContributorAuthor

    @SwayamInSync This should definitely be fixed, but since there is a workaround it's not urgent (can be included in the upcoming big release)

  6. seberg commented on Dec 1, 2025

    @seberg
    Member

    Yeah, should at least raise a nice error. For most use-cases, I think a[m] = v is nicer (yes, place has some funny semantics).

  7. juntyr commented on Jan 16, 2026

    @juntyr
    ContributorAuthor

    @SwayamInSync This is still not fixed in the current main branch version

  8. SwayamInSync commented on Jan 16, 2026

    @SwayamInSync
    Member

    Yes this and other issues makred at #bugs are depending on the same changes to be made on numpy + adding support to different endian casting within quaddtype

    So this might take a while and not that critical as a workaround exists, we will cover this in future releases

  9. juntyr commented on Jan 16, 2026

    @juntyr
    ContributorAuthor

    Ok, thanks for the update! I pulled some wheels from CI to test v1.0 with my downstream project and removed all bug-workarounds from earlier; this is the only one I still need but everything else seems to be working so far

  10. added theissue type on Jan 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions