[Debian-med-packaging] Bug#917693: Test suite uncovers issues with latest numpy version (#1648)

Yoshiki Vázquez Baeza notifications at github.com
Wed Jan 9 21:37:04 GMT 2019


Thanks for reporting this. From looking around, it looks like this was the consequence of a bug-fix in NumPy 1.16:

```
Arrays based off readonly buffers cannot be set writeable
-------------------------------------------------------------
We now disallow setting the writeable flag True on arrays created
from fromstring(readonly-buffer).
```

PR in Numpy here: https://github.com/numpy/numpy/pull/11739

I am not familiar with the code in sequence.py but maybe @ebolyen can have a look? From some tinkering in the console, it looks like copying the data into a byte array and then passing that to `np.frombuffer` should suffice. For example:


This is what we have in _sequence.py.

```
# this fails 👎
In [1]: import numpy as np
   ...: s = 'asdf'.encode('ascii')
   ...: x = np.frombuffer(s, dtype=np.uint8)
   ...:

In [2]: x.flags.writeable = True
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-2-95da424ff829> in <module>
----> 1 x.flags.writeable = True

ValueError: cannot set WRITEABLE flag to True of this array

```

This is as inspired from some comments in the NumPy PR:

```
# this works 👍
In [3]: q = bytearray(4)

In [4]: q[:] = 'asdf'.encode('ascii')

In [10]: x = np.frombuffer(q, dtype=np.uint8)

In [11]: x.flags.writeable = True
```



--------------

This is the [failing unit test](https://github.com/biocore/scikit-bio/blob/master/skbio/sequence/tests/test_grammared_sequence.py#L238).

-- 
You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub:
https://github.com/biocore/scikit-bio/issues/1648#issuecomment-452862428
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-packaging/attachments/20190109/1c339314/attachment-0001.html>


More information about the Debian-med-packaging mailing list