summaryrefslogtreecommitdiff
path: root/numpy/typing
diff options
context:
space:
mode:
authorBas van Beek <b.f.van.beek@vu.nl>2022-05-25 14:48:59 +0200
committerBas van Beek <b.f.van.beek@vu.nl>2022-05-25 16:12:18 +0200
commit48c0c0e784dcd852c577310a4bd9dc9253f27e29 (patch)
treeac14c843e8176ed02bf27a75bd1152f6172632b4 /numpy/typing
parent7e15fd77ca6c09989f219acf432c98a1036d14c5 (diff)
downloadnumpy-48c0c0e784dcd852c577310a4bd9dc9253f27e29.tar.gz
TYP: Allow unsigned integer inplace-ops to accept signed integers
Inplace ops generally use "same_kind" casting w.r.t. to the left operand. An exception to this rule are unsigned integers though, which also accepts a signed integer (array) for the right operand as long as all its values are >=0.
Diffstat (limited to 'numpy/typing')
-rw-r--r--numpy/typing/tests/data/pass/arithmetic.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/numpy/typing/tests/data/pass/arithmetic.py b/numpy/typing/tests/data/pass/arithmetic.py
index fe1612906..4ed69c923 100644
--- a/numpy/typing/tests/data/pass/arithmetic.py
+++ b/numpy/typing/tests/data/pass/arithmetic.py
@@ -185,6 +185,10 @@ AR_LIKE_f - AR_O
AR_LIKE_c - AR_O
AR_LIKE_O - AR_O
+AR_u += AR_b
+AR_u += AR_u
+AR_u += 1 # Allowed during runtime as long as the object is 0D and >=0
+
# Array floor division
AR_b // AR_LIKE_b