mirror of
https://github.com/python/cpython.git
synced 2025-11-26 21:33:10 +00:00
Issue #7616: Fix copying of overlapping memoryview slices with the Intel
compiler.
This commit is contained in:
parent
349d558e0d
commit
1ac745b5c5
2 changed files with 6 additions and 11 deletions
|
|
@ -12,6 +12,9 @@ What's New in Python 3.2 Alpha 1?
|
||||||
Core and Builtins
|
Core and Builtins
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
|
- Issue #7616: Fix copying of overlapping memoryview slices with the Intel
|
||||||
|
compiler.
|
||||||
|
|
||||||
- Issue #8413: structsequence now subclasses tuple.
|
- Issue #8413: structsequence now subclasses tuple.
|
||||||
|
|
||||||
- Issue #8271: during the decoding of an invalid UTF-8 byte sequence, only the
|
- Issue #8271: during the decoding of an invalid UTF-8 byte sequence, only the
|
||||||
|
|
|
||||||
|
|
@ -624,7 +624,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;
|
||||||
|
|
@ -694,16 +694,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;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue