summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorMatti Picus <matti.picus@gmail.com>2019-06-28 18:27:42 -0700
committerSebastian Berg <sebastian@sipsolutions.net>2019-06-28 18:27:42 -0700
commit59ebfbbe32bcac4a278c39a9a24b80a42d47a8f6 (patch)
treeabcdbeac29cc19a7bb839ab4578a08668e6eaef5 /doc
parente7383b5d5dff636ed92667a28751ce18f7086097 (diff)
downloadnumpy-59ebfbbe32bcac4a278c39a9a24b80a42d47a8f6.tar.gz
ENH: Deprecate writeable broadcast_array (#12609)
When the base is not an array (or generally when the flag of the base array was toggled), it is OK to allow setting the writeable flag to True, as long as any ancestor (especially the last one) is writeable. This commit also slightly change the behaviour of the base attribute. --- * ENH: Deprecate writeable broadcast_array * ENH: Make writeable flag enabling more reliable for non-array bases When the base is not an array (or generally when the flag of the base array was toggled), it is OK to allow setting the writeable flag to True, as long as any ancestor (especially the last one) is writeable. * Update doc/release/1.17.0-notes.rst Co-Authored-By: Sebastian Berg <sebastian@sipsolutions.net> * Update doc/release/1.17.0-notes.rst Co-Authored-By: Sebastian Berg <sebastian@sipsolutions.net> * Update numpy/lib/tests/test_stride_tricks.py Co-Authored-By: Sebastian Berg <sebastian@sipsolutions.net> * Update numpy/core/tests/test_multiarray.py Co-Authored-By: Sebastian Berg <sebastian@sipsolutions.net> * DOC: improve warning (from review)
Diffstat (limited to 'doc')
-rw-r--r--doc/release/1.17.0-notes.rst26
1 files changed, 26 insertions, 0 deletions
diff --git a/doc/release/1.17.0-notes.rst b/doc/release/1.17.0-notes.rst
index f053b2ef6..e5928c9e9 100644
--- a/doc/release/1.17.0-notes.rst
+++ b/doc/release/1.17.0-notes.rst
@@ -50,6 +50,21 @@ always incorrect. If the old behavior was intended, it can be preserved without
a warning by using ``nonzero(atleast_1d(arr))`` instead of ``nonzero(arr)``.
In a future release, it is most likely this will raise a `ValueError`.
+Writing to the result of `numpy.broadcast_arrays` will warn
+-----------------------------------------------------------
+
+Commonly `numpy.broadcast_arrays` returns a writeable array with internal
+overlap, making it unsafe to write to. A future version will set the
+``writeable`` flag to ``False``, and require users to manually set it to
+``True`` if they are sure that is what they want to do. Now writing to it will
+emit a deprecation warning with instructions to set the ``writeable`` flag
+``True``. Note that if one were to inspect the flag before setting it, one
+would find it would already be ``True``. Explicitly setting it, though, as one
+will need to do in future versions, clears an internal flag that is used to
+produce the deprecation warning. To help alleviate confusion, an additional
+`FutureWarning` will be emitted when accessing the ``writeable`` flag state to
+clarify the contradiction.
+
Future Changes
==============
@@ -148,6 +163,17 @@ Previously, ``can_cast`` returned `True` for almost all inputs for
from a structured dtype to a regular one. This has been fixed, making it
more consistent with actual casting using, e.g., the ``.astype`` method.
+``arr.writeable`` can be switched to true slightly more often
+-------------------------------------------------------------
+
+In rare cases, it was not possible to switch an array from not writeable
+to writeable, although a base array is writeable. This can happen if an
+intermediate ``arr.base`` object is writeable. Previously, only the deepest
+base object was considered for this decision. However, in rare cases this
+object does not have the necessary information. In that case switching to
+writeable was never allowed. This has now been fixed.
+
+
C API changes
=============