thouis / numpy-trac-migration

numpy Trac to github issues migration
2 stars 3 forks source link

Bus error when attempting to use itemset() on a read-only memory-mapped array (Trac #1622) #5423

Open numpy-gitbot opened 12 years ago

numpy-gitbot commented 12 years ago

Original ticket http://projects.scipy.org/numpy/ticket/1622 on 2010-09-26 by atmention:WarrenWeckesser, assigned to unknown.

From http://projects.scipy.org/scipy/ticket/1202

In [1]: import numpy as np

In [2]: np.__version__
Out[2]: '1.5.0.dev8712'

In [3]: !cat tmp.dat
DBC

In [4]: m = np.memmap('tmp.dat', np.uint8, 'r')

In [5]: m[0:1].itemset(65)
Bus error

The bus error does not occur if the file is opened with mode 'r+'.

numpy-gitbot commented 12 years ago

Attachment added by trac user jpeel on 2011-01-04: 0001-BF-fix-for-itemset-read-only-memmap-segfault.patch

numpy-gitbot commented 12 years ago

trac user jpeel wrote on 2011-01-04

This was actually segfaulting on me rather than giving me a bus error. I added a patch that will raise an exception saying that the 'array is not writetable' in a similar manner to exceptions raised by other forms of trying to set an element in a read-only memmapped array. I also took out an extra space in one of the others exception messages nearby.

numpy-gitbot commented 12 years ago

atmention:WarrenWeckesser wrote on 2012-01-28

Fixed in b95db7f9

Thanks, jpeel.