diff options
author | Nathaniel J. Smith <njs@pobox.com> | 2012-05-14 23:43:45 +0100 |
---|---|---|
committer | Nathaniel J. Smith <njs@pobox.com> | 2012-05-15 15:02:24 +0100 |
commit | cbce4e6565e7a7fbe065502b264622ce7d64740a (patch) | |
tree | 62d357798d50da349e8e377ac0449ece2e0c23af /doc | |
parent | 3bbbbd416a0ae68d68a11bbbedca1460a560378b (diff) | |
download | numpy-cbce4e6565e7a7fbe065502b264622ce7d64740a.tar.gz |
Consolidate all array writeability checking in new PyArray_RequireWriteable
This is mostly a code cleanup, but it does have a user-visible effect
in that attempting to write to a unwriteable array now consistently
raises ValueError. (It used to randomly raise either ValueError or
RuntimeError.)
Passes numpy.test("full").
Diffstat (limited to 'doc')
-rw-r--r-- | doc/release/2.0.0-notes.rst | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/doc/release/2.0.0-notes.rst b/doc/release/2.0.0-notes.rst index 3b61afc31..978d9139e 100644 --- a/doc/release/2.0.0-notes.rst +++ b/doc/release/2.0.0-notes.rst @@ -148,6 +148,14 @@ New argument to searchsorted The function searchsorted now accepts a 'sorter' argument that is a permuation array that sorts the array to search. +C API +----- + +New function ``PyArray_RequireWriteable`` provides a consistent +interface for checking array writeability -- any C code which works +with arrays whose WRITEABLE flag is not know to be True a priori, +should make sure to call this function before writing. + Changes ======= @@ -166,6 +174,11 @@ during alpha or early beta testing, and a decision to either keep the stricter behavior, or add in a hack to allow the previous behavior to work. +Attempting to write to a read-only array (one with +``arr.flags.writeable`` set to ``False``) used to raise either a +RuntimeError, ValueError, or TypeError inconsistently, depending on +which code path was taken. It now consistently raises a ValueError. + The functions np.diag, np.diagonal, and <ndarray>.diagonal now return a view into the original array instead of making a copy. This makes these functions more consistent with NumPy's general approach of taking views |