Merged revisions 82814 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r82814 | antoine.pitrou | 2010-07-11 14:12:00 +0200 (dim., 11 juil. 2010) | 4 lines

  Issue #7616: Fix copying of overlapping memoryview slices with the Intel
  compiler.
........
This commit is contained in:
Antoine Pitrou 2010-07-11 12:14:05 +00:00
parent fbf2f14777
commit 3266978300
2 changed files with 5 additions and 11 deletions

View File

@ -12,6 +12,8 @@ What's New in Python 2.7.1?
Core and Builtins Core and Builtins
----------------- -----------------
- Issue #7616: Fix copying of overlapping memoryview slices with the Intel
compiler.
Library Library
------- -------

View File

@ -632,7 +632,7 @@ memory_subscript(PyMemoryViewObject *self, PyObject *key)
static int static int
memory_ass_sub(PyMemoryViewObject *self, PyObject *key, PyObject *value) memory_ass_sub(PyMemoryViewObject *self, PyObject *key, PyObject *value)
{ {
Py_ssize_t start, len, bytelen, i; Py_ssize_t start, len, bytelen;
Py_buffer srcview; Py_buffer srcview;
Py_buffer *view = &(self->view); Py_buffer *view = &(self->view);
char *srcbuf, *destbuf; char *srcbuf, *destbuf;
@ -702,16 +702,8 @@ memory_ass_sub(PyMemoryViewObject *self, PyObject *key, PyObject *value)
if (destbuf + bytelen < srcbuf || srcbuf + bytelen < destbuf) if (destbuf + bytelen < srcbuf || srcbuf + bytelen < destbuf)
/* No overlapping */ /* No overlapping */
memcpy(destbuf, srcbuf, bytelen); memcpy(destbuf, srcbuf, bytelen);
else if (destbuf < srcbuf) { else
/* Copy in ascending order */ memmove(destbuf, srcbuf, bytelen);
for (i = 0; i < bytelen; i++)
destbuf[i] = srcbuf[i];
}
else {
/* Copy in descencing order */
for (i = bytelen - 1; i >= 0; i--)
destbuf[i] = srcbuf[i];
}
PyBuffer_Release(&srcview); PyBuffer_Release(&srcview);
return 0; return 0;