diff options
author | Kevin Sheppard <bashtage@users.noreply.github.com> | 2021-02-24 15:19:27 +0000 |
---|---|---|
committer | Kevin Sheppard <kevin.sheppard@gmail.com> | 2021-02-26 22:41:04 +0000 |
commit | 2ee92e20151f5c7b0c5602a550b91b9171898210 (patch) | |
tree | 5f25cad21f26d8a023dbf1df457d85cebb966118 /numpy | |
parent | 9e068f4032dab58cf310cfb663fa4930371cecf3 (diff) | |
download | numpy-2ee92e20151f5c7b0c5602a550b91b9171898210.tar.gz |
Accept suggestion
Use if else.
Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/random/_generator.pyx | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/numpy/random/_generator.pyx b/numpy/random/_generator.pyx index 856b1cc21..b0bfd860c 100644 --- a/numpy/random/_generator.pyx +++ b/numpy/random/_generator.pyx @@ -3756,7 +3756,6 @@ cdef class Generator: pix = <double*>np.PyArray_DATA(parr) check_array_constraint(parr, 'pvals', CONS_BOUNDED_0_1) if kahan_sum(pix, d-1) > (1.0 + 1e-12): - msg = "sum(pvals[:-1]) > 1.0" # When floating, but not float dtype, and close, improve the error # 1.0001 works for float16 and float32 if (isinstance(pvals, np.ndarray) and @@ -3768,6 +3767,8 @@ cdef class Generator: "checking the constraint. Changes in precision when " "casting may produce violations even if " "pvals[:-1].sum() <= 1.") + else: + msg = "sum(pvals[:-1]) > 1.0" raise ValueError(msg) if np.PyArray_NDIM(on) != 0: # vector |