Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
Back to tool/Back to issues
#26307·scipy

CI: dev-deps job fails with NumPy main — `np.broadcast_arrays` now returns read-only views

Author: tschmCreated Sep 29, 2026Updated Oct 1, 2026
LabelsCI

The Linux tests / dev deps (py3.15) job, which builds against NumPy main (2.6.0.dev0), fails with 100 test failures on main: https://github.com/scipy/scipy/actions/runs/36559692192/job/109377336642

NumPy recently merged "ENH: Improve performance of np.broadcast_arrays and expire deprecation on writable views". np.broadcast_arrays now returns read-only views. Previously, writing to them only emitted a DeprecationWarning. SciPy writes to (or needs writable) broadcast results in two places:

  1. scipy.stats UNU.RAN samplers (99 failures in test_fast_gen_inversion.py, test_sampling.py): ValueError: buffer source array is read-only. When np.all(cond), argsreduce (_distn_infrastructure.py) returns ravelled broadcast_arrays views. The ppf/ppf_hat methods in unuran_wrapper.pyx then bind them to a non-const double[::1] memoryview.
  2. scipy._lib._elementwise_iterative_method._initialize (1 failure, test_tanhsinh.py::test_improper_integrals): ValueError: assignment destination is read-only. The broadcast inputs are passed on to the user callable without a copy, and the test's callable modifies x in place.

Possible fixes: use const double[::1] memoryviews in unuran_wrapper.pyx; copy after broadcasting in _initialize; optionally make argsreduce return writable arrays; audit other broadcast_arrays usages.

Source: scipy/scipy

View original on GitHubView discussion on GitHub