From 6bdd96c9641f49239f3069a9dc5748d7292840e6 Mon Sep 17 00:00:00 2001 From: Hood Chatham Date: Thu, 27 Jan 2022 00:13:32 -0800 Subject: [PATCH] Fix numpy fatal error: incorrect random_float_fill return type (#2137) Upstream PR numpy/numpy#20911 --- packages/numpy/meta.yaml | 1 + .../fix-random_float_fill-return-type.patch | 33 +++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 packages/numpy/patches/fix-random_float_fill-return-type.patch diff --git a/packages/numpy/meta.yaml b/packages/numpy/meta.yaml index 7ddd3fc90..761da52f8 100644 --- a/packages/numpy/meta.yaml +++ b/packages/numpy/meta.yaml @@ -23,6 +23,7 @@ source: - patches/fix-invalid-asm-instruction.patch - patches/fix-removed-decorators-module.patch - patches/fix-comparator-function-signatures.patch + - patches/fix-random_float_fill-return-type.patch build: skip_host: False diff --git a/packages/numpy/patches/fix-random_float_fill-return-type.patch b/packages/numpy/patches/fix-random_float_fill-return-type.patch new file mode 100644 index 000000000..9dbb5ce06 --- /dev/null +++ b/packages/numpy/patches/fix-random_float_fill-return-type.patch @@ -0,0 +1,33 @@ +From 575e6b726adcd2c1bef5ca0185aa2b2178cea20e Mon Sep 17 00:00:00 2001 +From: Hood Chatham +Date: Wed, 26 Jan 2022 18:59:47 -0800 +Subject: [PATCH] BUG: Fix the return type of random_float_fill + +The `random_float_fill` function type is declared with return type `double` but +I think this is a typo. The actual implementation of `random_float_fill` is +`random_standard_uniform_fill_f` which has return type `void`: + +void random_standard_uniform_fill_f(bitgen_t *bitgen_state, npy_intp cnt, float *out) + +Also, `random_double_fill` is declared with return type `void`. This fixes the +return type of `random_float_fill` to match. +--- + numpy/random/_common.pxd | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/numpy/random/_common.pxd b/numpy/random/_common.pxd +index 9f2e8c3ca..3625634cd 100644 +--- a/numpy/random/_common.pxd ++++ b/numpy/random/_common.pxd +@@ -45,7 +45,7 @@ + ctypedef double (*random_double_2)(void *state, double a, double b) nogil + ctypedef double (*random_double_3)(void *state, double a, double b, double c) nogil + +-ctypedef double (*random_float_fill)(bitgen_t *state, np.npy_intp count, float* out) nogil ++ctypedef void (*random_float_fill)(bitgen_t *state, np.npy_intp count, float* out) nogil + ctypedef float (*random_float_0)(bitgen_t *state) nogil + ctypedef float (*random_float_1)(bitgen_t *state, float a) nogil + +-- +2.25.1 +