mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
Merge from 3.4.
This commit is contained in:
commit
2e6658b4a7
2 changed files with 53 additions and 2 deletions
|
@ -512,7 +512,7 @@ PyBuffer_FromContiguous(Py_buffer *view, void *buf, Py_ssize_t len, char fort)
|
|||
|
||||
/* Otherwise a more elaborate scheme is needed */
|
||||
|
||||
/* XXX(nnorwitz): need to check for overflow! */
|
||||
/* view->ndim <= 64 */
|
||||
indices = (Py_ssize_t *)PyMem_Malloc(sizeof(Py_ssize_t)*(view->ndim));
|
||||
if (indices == NULL) {
|
||||
PyErr_NoMemory();
|
||||
|
@ -534,10 +534,10 @@ PyBuffer_FromContiguous(Py_buffer *view, void *buf, Py_ssize_t len, char fort)
|
|||
*/
|
||||
elements = len / view->itemsize;
|
||||
while (elements--) {
|
||||
addone(view->ndim, indices, view->shape);
|
||||
ptr = PyBuffer_GetPointer(view, indices);
|
||||
memcpy(ptr, src, view->itemsize);
|
||||
src += view->itemsize;
|
||||
addone(view->ndim, indices, view->shape);
|
||||
}
|
||||
|
||||
PyMem_Free(indices);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue