Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit dedbbe6

Browse files
committed
Merged revisions 82814 via svnmerge from
svn+ssh://[email protected]/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. ........
1 parent f306acc commit dedbbe6

2 files changed

Lines changed: 6 additions & 11 deletions

File tree

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ What's New in Python 3.1.3?
1212
Core and Builtins
1313
-----------------
1414

15+
- Issue #7616: Fix copying of overlapping memoryview slices with the Intel
16+
compiler.
17+
1518
- Issue #8271: during the decoding of an invalid UTF-8 byte sequence, only the
1619
start byte and the continuation byte(s) are now considered invalid, instead
1720
of the number of bytes specified by the start byte.

Objects/memoryobject.c

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ memory_subscript(PyMemoryViewObject *self, PyObject *key)
624624
static int
625625
memory_ass_sub(PyMemoryViewObject *self, PyObject *key, PyObject *value)
626626
{
627-
Py_ssize_t start, len, bytelen, i;
627+
Py_ssize_t start, len, bytelen;
628628
Py_buffer srcview;
629629
Py_buffer *view = &(self->view);
630630
char *srcbuf, *destbuf;
@@ -694,16 +694,8 @@ memory_ass_sub(PyMemoryViewObject *self, PyObject *key, PyObject *value)
694694
if (destbuf + bytelen < srcbuf || srcbuf + bytelen < destbuf)
695695
/* No overlapping */
696696
memcpy(destbuf, srcbuf, bytelen);
697-
else if (destbuf < srcbuf) {
698-
/* Copy in ascending order */
699-
for (i = 0; i < bytelen; i++)
700-
destbuf[i] = srcbuf[i];
701-
}
702-
else {
703-
/* Copy in descencing order */
704-
for (i = bytelen - 1; i >= 0; i--)
705-
destbuf[i] = srcbuf[i];
706-
}
697+
else
698+
memmove(destbuf, srcbuf, bytelen);
707699

708700
PyBuffer_Release(&srcview);
709701
return 0;

0 commit comments

Comments
 (0)