summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormattip <matti.picus@gmail.com>2018-04-21 22:56:55 +0300
committermattip <matti.picus@gmail.com>2018-04-21 22:56:55 +0300
commitfa9a74165479142e2c1671f871fe7c860146cd52 (patch)
tree1cc11347143043da7beac90cea9249ea34387c2a
parentc26d273c1204d75fe5ab2ce9591e1b0b0b0880e1 (diff)
downloadnumpy-fa9a74165479142e2c1671f871fe7c860146cd52.tar.gz
fixes from review
-rw-r--r--numpy/add_newdocs.py7
-rw-r--r--numpy/core/src/multiarray/arrayobject.c2
-rw-r--r--numpy/core/src/multiarray/nditer_pywrap.c9
3 files changed, 5 insertions, 13 deletions
diff --git a/numpy/add_newdocs.py b/numpy/add_newdocs.py
index a48b76a8d..c2d2c0949 100644
--- a/numpy/add_newdocs.py
+++ b/numpy/add_newdocs.py
@@ -392,10 +392,11 @@ add_newdoc('numpy.core', 'nditer',
... [['writeonly', 'updateifcopy']],
... casting='unsafe',
... op_dtypes=[np.dtype('f4')]) as i:
- ... i.operands[0][:] = [-1, -2, -3]
+ ... x = i.operands[0]
+ ... x[:] = [-1, -2, -3]
... # a still unchanged here
- >>> a
- array([-1, -2, -3])
+ >>> a, x
+ array([-1, -2, -3]), array([-1, -2, -3])
It is important to note that once the iterator is exited, dangling
references (like `x` in the example) may or may not share data with
diff --git a/numpy/core/src/multiarray/arrayobject.c b/numpy/core/src/multiarray/arrayobject.c
index 51f352cc5..69538c6b7 100644
--- a/numpy/core/src/multiarray/arrayobject.c
+++ b/numpy/core/src/multiarray/arrayobject.c
@@ -497,7 +497,7 @@ array_dealloc(PyArrayObject *self)
}
if (PyArray_FLAGS(self) & NPY_ARRAY_UPDATEIFCOPY) {
/* DEPRECATED, remove once the flag is removed */
- char const * msg = "ERROR: UPDATEIFCOPY detected in array_dealloc. "
+ char const * msg = "UPDATEIFCOPY detected in array_dealloc. "
" Required call to PyArray_ResolveWritebackIfCopy or "
"PyArray_DiscardWritebackIfCopy is missing";
Py_INCREF(self); /* hold on to self in next call since if
diff --git a/numpy/core/src/multiarray/nditer_pywrap.c b/numpy/core/src/multiarray/nditer_pywrap.c
index 8efae59a6..d36be61f5 100644
--- a/numpy/core/src/multiarray/nditer_pywrap.c
+++ b/numpy/core/src/multiarray/nditer_pywrap.c
@@ -29,7 +29,6 @@ struct NewNpyArrayIterObject_tag {
/* Flag indicating iteration started/stopped */
char started, finished;
/* iter must used as a context manager if writebackifcopy semantics used */
- char needs_context_manager;
char managed;
/* Child to update for nested iteration */
NewNpyArrayIterObject *nested_child;
@@ -91,7 +90,6 @@ npyiter_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds)
self->iter = NULL;
self->nested_child = NULL;
self->managed = CONTEXT_NOTENTERED;
- self->needs_context_manager = 0;
}
return (PyObject *)self;
@@ -827,13 +825,6 @@ npyiter_init(NewNpyArrayIterObject *self, PyObject *args, PyObject *kwds)
goto fail;
}
- for (iop = 0; iop < nop; ++iop) {
- if (op_flags[iop] & NPY_ITER_READWRITE) {
- self->needs_context_manager = 1;
- }
-
- }
-
/* Cache some values for the member functions to use */
if (npyiter_cache_values(self) < 0) {
goto fail;