[Python-checkins] r82815 - in python/branches/release27-maint: Misc/NEWS Objects/memoryobject.c

antoine.pitrou python-checkins at python.org
Sun Jul 11 14:14:05 CEST 2010


Author: antoine.pitrou
Date: Sun Jul 11 14:14:05 2010
New Revision: 82815

Log:
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.
........


Modified:
   python/branches/release27-maint/   (props changed)
   python/branches/release27-maint/Misc/NEWS
   python/branches/release27-maint/Objects/memoryobject.c

Modified: python/branches/release27-maint/Misc/NEWS
==============================================================================
--- python/branches/release27-maint/Misc/NEWS	(original)
+++ python/branches/release27-maint/Misc/NEWS	Sun Jul 11 14:14:05 2010
@@ -12,6 +12,8 @@
 Core and Builtins
 -----------------
 
+- Issue #7616: Fix copying of overlapping memoryview slices with the Intel
+  compiler.
 
 Library
 -------

Modified: python/branches/release27-maint/Objects/memoryobject.c
==============================================================================
--- python/branches/release27-maint/Objects/memoryobject.c	(original)
+++ python/branches/release27-maint/Objects/memoryobject.c	Sun Jul 11 14:14:05 2010
@@ -632,7 +632,7 @@
 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;
@@ -702,16 +702,8 @@
     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;


More information about the Python-checkins mailing list