homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients vstinner
Date 2010年04月03日.15:24:41
SpamBayes Score 0.00071431947
Marked as misclassified No
Message-id <1270308282.65.0.542260907353.issue8305@psf.upfronthosting.co.za>
In-reply-to
Content
memory_item() function creates a new memoryview object if ndim is different than 1. Example with numpy:
 from numpy import array
 y=array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11])
 y.shape = 3,4
 view=memoryview(y)
 view2 = view[0]
 print type(view2)
Result: <type 'memoryview'>. (Without the shape, ndim equals 1, and view2 is a standard str object.)
The problem is that view attribute of the view2 (PyMemoryViewObject) is not initialized. Extract of memory_item():
 /* Return a new memory-view object */
 Py_buffer newview;
 memset(&newview, 0, sizeof(newview));
 /* XXX: This needs to be fixed so it actually returns a sub-view */
 return PyMemoryView_FromBuffer(&newview);
"This needs to be fixed" :-/
--
view2 is not initialized and so view2.tolist() does crash.
History
Date User Action Args
2010年04月03日 15:24:42vstinnersetrecipients: + vstinner
2010年04月03日 15:24:42vstinnersetmessageid: <1270308282.65.0.542260907353.issue8305@psf.upfronthosting.co.za>
2010年04月03日 15:24:41vstinnerlinkissue8305 messages
2010年04月03日 15:24:41vstinnercreate

AltStyle によって変換されたページ (->オリジナル) /