You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
__repr__ method of BaseRepresentation can fail #5889
The __repr__ method of the BaseRepresentation class uses a numpy view to access the values. It is possible to create objects for which this view cannot be taken, i.e (using v1.3.1):
Note that I have a fix in place for this by replacing this line with
# for complex shapes and structures, this may require a copytry:
returnnp.concatenate([coo.reshape(sh).valueforcooincoordinates],
axis=-1).view(dtype).squeeze()
except:
returnnp.concatenate([coo.reshape(sh).valueforcooincoordinates],
axis=-1).astype(dtype).squeeze()
however, I'm struggling to add a regression test, since the example above runs into the exception reported in #5890 , which is thornier issue.
I cannot think of another way to create an N-D representation which cannot be accessed using a view like the one above.
Activity
StuartLittlefair commentedon Mar 21, 2017
Note that I have a fix in place for this by replacing this line with
however, I'm struggling to add a regression test, since the example above runs into the exception reported in #5890 , which is thornier issue.
I cannot think of another way to create an N-D representation which cannot be accessed using a view like the one above.
mhvk commentedon Mar 21, 2017
Hmm, not good, that! Here is a simpler test:
mhvk commentedon Mar 21, 2017
My own sense would be to rewrite the code to something more robust, along the lines of
I'll make a quick PR...
mhvk commentedon Mar 21, 2017
See #5896 for a fix.