diff options
author | Matti Picus <matti.picus@gmail.com> | 2022-10-11 19:34:59 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-11 19:34:59 +0300 |
commit | 226f9c537ff9c0da56884f5ef5b5220c6c3629e9 (patch) | |
tree | 107da63c0a668868406571953aabc03f89adb099 /doc | |
parent | 7036b164ed1d59df870c35a90ab2e6148ba976cc (diff) | |
parent | 5f1102429b0602e9ed6ad644295dc8f3f7a43b95 (diff) | |
download | numpy-226f9c537ff9c0da56884f5ef5b5220c6c3629e9.tar.gz |
Merge pull request #22385 from seberg/deprecate-out-of-bound-pyint-conversion
DEP: Deprecate conversion of out-of-bound Python integers
Diffstat (limited to 'doc')
-rw-r--r-- | doc/release/upcoming_changes/22393.deprecation.rst | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/doc/release/upcoming_changes/22393.deprecation.rst b/doc/release/upcoming_changes/22393.deprecation.rst new file mode 100644 index 000000000..52099506c --- /dev/null +++ b/doc/release/upcoming_changes/22393.deprecation.rst @@ -0,0 +1,17 @@ +Conversion of out-of-bound Python integers +------------------------------------------ +Attempting a conversion from a Python integer to a NumPy +value will now always check whether the result can be +represented by NumPy. This means the following examples will +fail in the future and give a ``DeprecationWarning`` now:: + + np.uint8(-1) + np.array([3000], dtype=np.int8) + +Many of these did succeed before. Such code was mainly +useful for unsigned integers with negative values such as +`np.uint8(-1)` giving `np.iinfo(np.uint8).max`. + +Note that conversion between NumPy integers is unaffected, +so that `np.array(-1).astype(np.uint8)` continues to work +and use C integer overflow logic. |