Author chuck
Recipients chuck
Date 2009-10-05.08:12:27
SpamBayes Score 2.67715e-09
Marked as misclassified No
Message-id <1254730349.27.0.71088310024.issue7063@psf.upfronthosting.co.za>
In-reply-to
Content
While I was backporting the new buffer API to 2.7 I noticed some issues 
in array_ass_slice() in Modules/arraymodule.c in the python 3k branch.

1) Manual memory reallocation had been replaced by calls to 
array_resize. But I think when PyMem_RESIZE is called the pointer to the 
memory might change. So this now happens in array_resize, and the
array->ob_item pointer changes but not it's local copy (item) in 
array_ass_slice().

2) The function moves too much memory if the array size is increased: 
(Py_SIZE(a)-d-ihigh) items should be moved, because Py_SIZE(a) was 
already modified by array_resize, but the function moves (Py_SIZE(a)-
ihigh) items.

While 1) might go unnoticed, 2) definitely broke slice tests in a 
"segmentation fault"-way (in debug mode forbidden bits show the error). 
I tried to write a test, but I don't know how to trigger 
array_ass_slice() with a write access, as it is not in array_as_sequence 
anymore (like in 2.7). How is slicing handled now?
History
Date User Action Args
2009-10-05 08:12:29chucksetrecipients: + chuck
2009-10-05 08:12:29chucksetmessageid: <1254730349.27.0.71088310024.issue7063@psf.upfronthosting.co.za>
2009-10-05 08:12:28chucklinkissue7063 messages
2009-10-05 08:12:27chuckcreate