Closed smoia closed 1 year ago
The issue is with degree = degree.diagonal()
on line 121 of laplacian.py
. This makes a view of the array, rather than a copy, and views can't be assigned to. You can easily make a copy instead by changing the line to degree = degree.diagonal().copy()
. This stack overflow Q/A has some more information on what's going on.
Hello! Not sure this is a bug, but similar code elsewhere does not raise the same issue.
I wrote a test for a function that has a (input) numpy array element assignment at a certain point in the flow.
Running it in pytest raises:
ValueError: assignment destination is read-only
Running the same function outside of pytest does not provide the same error.
A similar behaviour in a different function does not raise any issue.
You can find the line here, compare with this line that is similar but passes tests. The test that fails raising this issue is here. The log of an independent CI is here (this test is with python3.7, there's another test with python 3.10, and on my system I have python 3.8)
I do not understand why the variable I am assigning is read-only, honestly. When I check variable value with pdb on crash, the variable is returned as intended after the line run.
Versions:
pytest: 7.2.0, python: 3.8.10, 3.7.15, 3.10.8, OS: Ubuntu 20.04
pip3 list: