forked from pool/python-numpy
22 lines
967 B
Diff
22 lines
967 B
Diff
|
Index: numpy-1.6.2/numpy/core/src/multiarray/methods.c
|
||
|
===================================================================
|
||
|
--- numpy-1.6.2.orig/numpy/core/src/multiarray/methods.c
|
||
|
+++ numpy-1.6.2/numpy/core/src/multiarray/methods.c
|
||
|
@@ -1476,7 +1476,15 @@ array_setstate(PyArrayObject *self, PyOb
|
||
|
if (!PyDataType_FLAGCHK(typecode, NPY_LIST_PICKLE)) {
|
||
|
int swap=!PyArray_ISNOTSWAPPED(self);
|
||
|
self->data = datastr;
|
||
|
- if (!_IsAligned(self) || swap) {
|
||
|
+#ifndef NPY_PY3K
|
||
|
+ /* Check that the string is not interned */
|
||
|
+ if (!_IsAligned(self) || swap || PyString_CHECK_INTERNED(rawdata)) {
|
||
|
+#else
|
||
|
+ /* Bytes should always be considered immutable, but we just grab the
|
||
|
+ * pointer if they are large, to save memory. */
|
||
|
+ if (!_IsAligned(self) || swap || (len <= 1000)) {
|
||
|
+#endif
|
||
|
+
|
||
|
intp num = PyArray_NBYTES(self);
|
||
|
self->data = PyDataMem_NEW(num);
|
||
|
if (self->data == NULL) {
|