From 2a1d9be05e976c7252d9f5a731dc7a01fae458b0 Mon Sep 17 00:00:00 2001 From: Jarl Haggerty Date: Sat, 27 Sep 2014 14:43:13 -0400 Subject: [PATCH 1/3] added 'c' to _pep3118_native_map and _pep3118_standard_map --- numpy/core/_internal.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/numpy/core/_internal.py b/numpy/core/_internal.py index d32f593904ae..3f04f342e562 100644 --- a/numpy/core/_internal.py +++ b/numpy/core/_internal.py @@ -310,6 +310,7 @@ def _index_fields(ary, fields): _pep3118_native_map = { '?': '?', + 'c': 'c', 'b': 'b', 'B': 'B', 'h': 'h', @@ -336,6 +337,7 @@ def _index_fields(ary, fields): _pep3118_standard_map = { '?': '?', + 'c': 'c', 'b': 'b', 'B': 'B', 'h': 'i2', From 32057e28de3de25bf740b3e6e84662f7a2ee8b2b Mon Sep 17 00:00:00 2001 From: Jarl Haggerty Date: Sat, 27 Sep 2014 16:08:15 -0400 Subject: [PATCH 2/3] Changed PyArray_PutTo to not write to read only arrays. --- numpy/core/src/multiarray/item_selection.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/numpy/core/src/multiarray/item_selection.c b/numpy/core/src/multiarray/item_selection.c index b2bf17f4c557..9a4f2883fcd5 100644 --- a/numpy/core/src/multiarray/item_selection.c +++ b/numpy/core/src/multiarray/item_selection.c @@ -265,6 +265,11 @@ PyArray_PutTo(PyArrayObject *self, PyObject* values0, PyObject *indices0, "put: first argument must be an array"); return NULL; } + + if (PyArray_FailUnlessWriteable(self, "put array") < 0) { + return NULL; + } + if (!PyArray_ISCONTIGUOUS(self)) { PyArrayObject *obj; int flags = NPY_ARRAY_CARRAY | NPY_ARRAY_UPDATEIFCOPY; From 11944f1db3ba666ea8c4b16820cd72413b4ef8f5 Mon Sep 17 00:00:00 2001 From: Jarl Haggerty Date: Sat, 27 Sep 2014 16:14:43 -0400 Subject: [PATCH 3/3] removed irrelevant change --- numpy/core/_internal.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/numpy/core/_internal.py b/numpy/core/_internal.py index 3f04f342e562..d32f593904ae 100644 --- a/numpy/core/_internal.py +++ b/numpy/core/_internal.py @@ -310,7 +310,6 @@ def _index_fields(ary, fields): _pep3118_native_map = { '?': '?', - 'c': 'c', 'b': 'b', 'B': 'B', 'h': 'h', @@ -337,7 +336,6 @@ def _index_fields(ary, fields): _pep3118_standard_map = { '?': '?', - 'c': 'c', 'b': 'b', 'B': 'B', 'h': 'i2',