diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2010-07-11 12:15:03 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2010-07-11 12:15:03 (GMT) |
commit | dedbbe6b3bfbf1fda4e333ec80507576c1725544 (patch) | |
tree | 19abf6d0a13efd7cf1334c50326c822b07fc2689 /Objects | |
parent | f306acc8dc11f30283ad8a97e9614ce2d21f803d (diff) | |
download | cpython-dedbbe6b3bfbf1fda4e333ec80507576c1725544.zip cpython-dedbbe6b3bfbf1fda4e333ec80507576c1725544.tar.gz cpython-dedbbe6b3bfbf1fda4e333ec80507576c1725544.tar.bz2 |
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.
........
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/memoryobject.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/Objects/memoryobject.c b/Objects/memoryobject.c index e92a771..5b3caf2 100644 --- a/Objects/memoryobject.c +++ b/Objects/memoryobject.c @@ -624,7 +624,7 @@ memory_subscript(PyMemoryViewObject *self, PyObject *key) static int 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 *view = &(self->view); char *srcbuf, *destbuf; @@ -694,16 +694,8 @@ memory_ass_sub(PyMemoryViewObject *self, PyObject *key, PyObject *value) if (destbuf + bytelen < srcbuf || srcbuf + bytelen < destbuf) /* No overlapping */ memcpy(destbuf, srcbuf, bytelen); - else if (destbuf < srcbuf) { - /* Copy in ascending order */ - 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]; - } + else + memmove(destbuf, srcbuf, bytelen); PyBuffer_Release(&srcview); return 0; |