numpy
Advanced tools
| name: Linux IBM tests | ||
| on: | ||
| pull_request: | ||
| branches: | ||
| - main | ||
| - maintenance/** | ||
| paths-ignore: | ||
| - '**.pyi' | ||
| - '**.md' | ||
| - '**.rst' | ||
| workflow_dispatch: | ||
| permissions: | ||
| contents: read | ||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
| cancel-in-progress: true | ||
| jobs: | ||
| native_ibm: | ||
| # These jobs runs only in the main NumPy repository. | ||
| # It requires a native ppc64le and s390x GHA runners, which are not available on forks. | ||
| # For more details, see: https://github.com/numpy/numpy/issues/29125 | ||
| if: github.repository == 'numpy/numpy' | ||
| runs-on: ${{ matrix.config.runner }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| config: | ||
| - name: "ppc64le/gcc - baseline(default)" | ||
| args: "-Dallow-noblas=false" | ||
| runner: ubuntu-24.04-ppc64le-p10 | ||
| compiler: "gcc" | ||
| - name: "ppc64le/clang - baseline(default)" | ||
| args: "-Dallow-noblas=false" | ||
| runner: ubuntu-24.04-ppc64le-p10 | ||
| compiler: "clang" | ||
| - name: "s390x/gcc - baseline(default)" | ||
| args: "-Dallow-noblas=false" | ||
| runner: ubuntu-24.04-s390x | ||
| compiler: "gcc" | ||
| - name: "s390x/clang - baseline(default)" | ||
| args: "-Dallow-noblas=false" | ||
| runner: ubuntu-24.04-s390x | ||
| compiler: "clang" | ||
| - name: "s390x/gcc - baseline(Z15/VXE2)" | ||
| args: "-Dallow-noblas=false -Dcpu-baseline=vxe2" | ||
| runner: ubuntu-24.04-s390x | ||
| compiler: "gcc" | ||
| - name: "s390x/clang - baseline(Z15/VXE2)" | ||
| args: "-Dallow-noblas=false -Dcpu-baseline=vxe2" | ||
| runner: ubuntu-24.04-s390x | ||
| compiler: "clang" | ||
| name: "${{ matrix.config.name }}" | ||
| steps: | ||
| - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 | ||
| with: | ||
| submodules: recursive | ||
| fetch-tags: true | ||
| - name: Install dependencies | ||
| run: | | ||
| sudo apt update | ||
| sudo apt install -y python3.12 python3-pip python3-dev ninja-build gfortran \ | ||
| build-essential libopenblas-dev liblapack-dev pkg-config | ||
| pip install --upgrade pip | ||
| pip install -r requirements/build_requirements.txt -r requirements/test_requirements.txt | ||
| echo "/home/runner/.local/bin" >> $GITHUB_PATH | ||
| - name: Install clang | ||
| if: matrix.config.compiler == 'clang' | ||
| run: | | ||
| sudo apt install -y clang-20 | ||
| echo CC=clang-20 >> $GITHUB_ENV | ||
| echo CXX=clang++-20 >> $GITHUB_ENV | ||
| - name: Meson Build | ||
| run: | | ||
| spin build -- ${{ matrix.config.args }} | ||
| - name: Meson Log | ||
| if: always() | ||
| run: cat build/meson-logs/meson-log.txt | ||
| - name: Run Tests | ||
| run: | | ||
| spin test -- --timeout=60 --durations=10 |
| Contributors | ||
| ============ | ||
| A total of 17 people contributed to this release. People with a "+" by their | ||
| names contributed a patch for the first time. | ||
| * Aleksei Nikiforov | ||
| * Ankit Ahlawat | ||
| * Breno Favaretto + | ||
| * Charles Harris | ||
| * Igor Krivenko + | ||
| * Ijtihed Kilani + | ||
| * Joren Hammudoglu | ||
| * Maarten Baert + | ||
| * Matti Picus | ||
| * Nathan Goldbaum | ||
| * Praneeth Kodumagulla + | ||
| * Ralf Gommers | ||
| * RoomWithOutRoof + | ||
| * Sebastian Berg | ||
| * Warren Weckesser | ||
| * Anarion Zuo + | ||
| * div + | ||
| Pull requests merged | ||
| ==================== | ||
| A total of 28 pull requests were merged for this release. | ||
| * `#31093 <https://github.com/numpy/numpy/pull/31093>`__: MAINT: Prepare 2.4.x for further development | ||
| * `#31182 <https://github.com/numpy/numpy/pull/31182>`__: TYP: fix ``np.shape`` assignability issue for python lists (#31171) | ||
| * `#31197 <https://github.com/numpy/numpy/pull/31197>`__: ENH: Return rank 0 for empty matrices in matrix_rank (#30422) | ||
| * `#31198 <https://github.com/numpy/numpy/pull/31198>`__: CI/BUG: add native jobs for s390x, fix bug in ``pack_inner``... | ||
| * `#31199 <https://github.com/numpy/numpy/pull/31199>`__: BUG: f2py map complex_long_double to NPY_CLONGDOUBLE | ||
| * `#31205 <https://github.com/numpy/numpy/pull/31205>`__: MAINT: f2py: Stop setting re._MAXCACHE to 50. | ||
| * `#31206 <https://github.com/numpy/numpy/pull/31206>`__: BUG: fix heap buffer overflow in timedelta to string casts | ||
| * `#31207 <https://github.com/numpy/numpy/pull/31207>`__: MAINT: Rename ppc64le and s390x workflow (#31121) | ||
| * `#31208 <https://github.com/numpy/numpy/pull/31208>`__: BUG: Fix matvec/vecmat in-place aliasing (out=input produces... | ||
| * `#31209 <https://github.com/numpy/numpy/pull/31209>`__: TYP: ``tile``\ : accept numpy scalars and arrays as second argument... | ||
| * `#31211 <https://github.com/numpy/numpy/pull/31211>`__: DEP: Undo deprecation for np.dtype() signature used by old pickles... | ||
| * `#31212 <https://github.com/numpy/numpy/pull/31212>`__: REV: Manual revert of float16 svml use (#31178) | ||
| * `#31222 <https://github.com/numpy/numpy/pull/31222>`__: TYP: ``ix_`` fix for boolean and non-1d input (#31218) | ||
| * `#31329 <https://github.com/numpy/numpy/pull/31329>`__: BUG: incorrect temp elision for new-style (NEP 43) user-defined... | ||
| * `#31330 <https://github.com/numpy/numpy/pull/31330>`__: TYP: fix sliding_window_view axis parameter typing | ||
| * `#31335 <https://github.com/numpy/numpy/pull/31335>`__: BUG: Prevent deadlock due to downstream importing NumPy in dlopen... | ||
| * `#31336 <https://github.com/numpy/numpy/pull/31336>`__: BUG: Fix segfault in nditer.multi_index when __getitem__ raises... | ||
| * `#31338 <https://github.com/numpy/numpy/pull/31338>`__: TYP: Fix ruff lint error | ||
| * `#31357 <https://github.com/numpy/numpy/pull/31357>`__: BUG: fix memory leak in np.zeros when fill-zero loop raises (#31320) | ||
| * `#31358 <https://github.com/numpy/numpy/pull/31358>`__: BUG: np.einsum() fails with a 0-dimensional out argument and... | ||
| * `#31379 <https://github.com/numpy/numpy/pull/31379>`__: BUG: Fix signed overflow issue in npy_gcd for INT_MIN on s390x... | ||
| * `#31383 <https://github.com/numpy/numpy/pull/31383>`__: CI: remove Cirrus CI FreeBSD job (#31380) | ||
| * `#31390 <https://github.com/numpy/numpy/pull/31390>`__: BUILD: newer MKL uses so.3 | ||
| * `#31391 <https://github.com/numpy/numpy/pull/31391>`__: BLD/MAINT: improve support for Intel LLVM compilers | ||
| * `#31401 <https://github.com/numpy/numpy/pull/31401>`__: BUG: Avoid UB in safe_[add,sub,mul] helpers (#31396) | ||
| * `#31402 <https://github.com/numpy/numpy/pull/31402>`__: BUG: exclude __pycache__ directories from wheels (#31397) | ||
| * `#31404 <https://github.com/numpy/numpy/pull/31404>`__: TYP: ``_NestedSequence`` type parameter default to work around... | ||
| * `#31426 <https://github.com/numpy/numpy/pull/31426>`__: TYP: Fix ``DTypeLike`` runtime type-checker support (#31425) | ||
| .. currentmodule:: numpy | ||
| ========================= | ||
| NumPy 2.4.5 Release Notes | ||
| ========================= | ||
| The NumPy 2.4.5 is a patch release that fixes bugs discovered after the 2.4.4 | ||
| release, has some typing improvements, and maintains infrastructure. | ||
| This release supports Python versions 3.11-3.14 | ||
| Contributors | ||
| ============ | ||
| A total of 17 people contributed to this release. People with a "+" by their | ||
| names contributed a patch for the first time. | ||
| * Aleksei Nikiforov | ||
| * Anarion Zuo + | ||
| * Ankit Ahlawat | ||
| * Breno Favaretto + | ||
| * Charles Harris | ||
| * Igor Krivenko + | ||
| * Ijtihed Kilani + | ||
| * Joren Hammudoglu | ||
| * Maarten Baert + | ||
| * Matti Picus | ||
| * Nathan Goldbaum | ||
| * Praneeth Kodumagulla + | ||
| * Ralf Gommers | ||
| * RoomWithOutRoof + | ||
| * Sebastian Berg | ||
| * Warren Weckesser | ||
| * div + | ||
| Pull requests merged | ||
| ==================== | ||
| A total of 28 pull requests were merged for this release. | ||
| * `#31093 <https://github.com/numpy/numpy/pull/31093>`__: MAINT: Prepare 2.4.x for further development | ||
| * `#31182 <https://github.com/numpy/numpy/pull/31182>`__: TYP: fix ``np.shape`` assignability issue for python lists (#31171) | ||
| * `#31197 <https://github.com/numpy/numpy/pull/31197>`__: ENH: Return rank 0 for empty matrices in matrix_rank (#30422) | ||
| * `#31198 <https://github.com/numpy/numpy/pull/31198>`__: CI/BUG: add native jobs for s390x, fix bug in ``pack_inner``... | ||
| * `#31199 <https://github.com/numpy/numpy/pull/31199>`__: BUG: f2py map complex_long_double to NPY_CLONGDOUBLE | ||
| * `#31205 <https://github.com/numpy/numpy/pull/31205>`__: MAINT: f2py: Stop setting re._MAXCACHE to 50. | ||
| * `#31206 <https://github.com/numpy/numpy/pull/31206>`__: BUG: fix heap buffer overflow in timedelta to string casts | ||
| * `#31207 <https://github.com/numpy/numpy/pull/31207>`__: MAINT: Rename ppc64le and s390x workflow (#31121) | ||
| * `#31208 <https://github.com/numpy/numpy/pull/31208>`__: BUG: Fix matvec/vecmat in-place aliasing (out=input produces... | ||
| * `#31209 <https://github.com/numpy/numpy/pull/31209>`__: TYP: ``tile``\ : accept numpy scalars and arrays as second argument... | ||
| * `#31211 <https://github.com/numpy/numpy/pull/31211>`__: DEP: Undo deprecation for np.dtype() signature used by old pickles... | ||
| * `#31212 <https://github.com/numpy/numpy/pull/31212>`__: REV: Manual revert of float16 svml use (#31178) | ||
| * `#31222 <https://github.com/numpy/numpy/pull/31222>`__: TYP: ``ix_`` fix for boolean and non-1d input (#31218) | ||
| * `#31329 <https://github.com/numpy/numpy/pull/31329>`__: BUG: incorrect temp elision for new-style (NEP 43) user-defined... | ||
| * `#31330 <https://github.com/numpy/numpy/pull/31330>`__: TYP: fix sliding_window_view axis parameter typing | ||
| * `#31335 <https://github.com/numpy/numpy/pull/31335>`__: BUG: Prevent deadlock due to downstream importing NumPy in dlopen... | ||
| * `#31336 <https://github.com/numpy/numpy/pull/31336>`__: BUG: Fix segfault in nditer.multi_index when __getitem__ raises... | ||
| * `#31338 <https://github.com/numpy/numpy/pull/31338>`__: TYP: Fix ruff lint error | ||
| * `#31357 <https://github.com/numpy/numpy/pull/31357>`__: BUG: fix memory leak in np.zeros when fill-zero loop raises (#31320) | ||
| * `#31358 <https://github.com/numpy/numpy/pull/31358>`__: BUG: np.einsum() fails with a 0-dimensional out argument and... | ||
| * `#31379 <https://github.com/numpy/numpy/pull/31379>`__: BUG: Fix signed overflow issue in npy_gcd for INT_MIN on s390x... | ||
| * `#31383 <https://github.com/numpy/numpy/pull/31383>`__: CI: remove Cirrus CI FreeBSD job (#31380) | ||
| * `#31390 <https://github.com/numpy/numpy/pull/31390>`__: BUILD: newer MKL uses so.3 | ||
| * `#31391 <https://github.com/numpy/numpy/pull/31391>`__: BLD/MAINT: improve support for Intel LLVM compilers | ||
| * `#31401 <https://github.com/numpy/numpy/pull/31401>`__: BUG: Avoid UB in safe_[add,sub,mul] helpers (#31396) | ||
| * `#31402 <https://github.com/numpy/numpy/pull/31402>`__: BUG: exclude __pycache__ directories from wheels (#31397) | ||
| * `#31404 <https://github.com/numpy/numpy/pull/31404>`__: TYP: ``_NestedSequence`` type parameter default to work around... | ||
| * `#31426 <https://github.com/numpy/numpy/pull/31426>`__: TYP: Fix ``DTypeLike`` runtime type-checker support (#31425) | ||
| from numpy.f2py import capi_maps | ||
| def test_complex_long_double_capi_map(): | ||
| assert capi_maps.c2capi_map["complex_long_double"] == "NPY_CLONGDOUBLE" | ||
| def test_complex_long_double_is_distinct(): | ||
| assert capi_maps.c2pycode_map["complex_long_double"] != capi_maps.c2pycode_map["complex_double"] | ||
| assert capi_maps.c2capi_map["complex_long_double"] != capi_maps.c2capi_map["complex_double"] |
@@ -315,2 +315,3 @@ name: BLAS tests (Linux) | ||
| for i in $( ls libmkl*.so.2 ); do ln -s $i ${i%.*}; done | ||
| for i in $( ls libmkl*.so.3 ); do ln -s $i ${i%.*}; done | ||
@@ -317,0 +318,0 @@ - name: Build with defaults (LP64) |
@@ -46,37 +46,2 @@ # Meson's Python module doesn't support crosscompiling, | ||
| - [ | ||
| "ppc64le", | ||
| "powerpc64le-linux-gnu", | ||
| "ppc64le/ubuntu:22.04", | ||
| "-Dallow-noblas=true", | ||
| "test_kind or test_multiarray or test_simd or test_umath or test_ufunc", | ||
| "ppc64le" | ||
| ] | ||
| - [ | ||
| "ppc64le - baseline(Power9)", | ||
| "powerpc64le-linux-gnu", | ||
| "ppc64le/ubuntu:22.04", | ||
| "-Dallow-noblas=true -Dcpu-baseline=vsx3", | ||
| "test_kind or test_multiarray or test_simd or test_umath or test_ufunc", | ||
| "ppc64le" | ||
| ] | ||
| - [ | ||
| "s390x", | ||
| "s390x-linux-gnu", | ||
| "s390x/ubuntu:22.04", | ||
| "-Dallow-noblas=true", | ||
| # Skipping TestRationalFunctions.test_gcd_overflow test | ||
| # because of a possible qemu bug that appears to be related to int64 overflow in absolute operation. | ||
| # TODO(@seiko2plus): Confirm the bug and provide a minimal reproducer, then report it to upstream. | ||
| "(test_kind or test_multiarray or test_simd or test_umath or test_ufunc) and not test_gcd_overflow", | ||
| "s390x" | ||
| ] | ||
| - [ | ||
| "s390x - baseline(Z13)", | ||
| "s390x-linux-gnu", | ||
| "s390x/ubuntu:22.04", | ||
| "-Dallow-noblas=true -Dcpu-baseline=vx", | ||
| "(test_kind or test_multiarray or test_simd or test_umath or test_ufunc) and not test_gcd_overflow", | ||
| "s390x" | ||
| ] | ||
| - [ | ||
| "riscv64", | ||
@@ -83,0 +48,0 @@ "riscv64-linux-gnu", |
+1
-0
@@ -83,2 +83,3 @@ # Prevent git from showing duplicate names with commands like "git shortlog" | ||
| Akhil Kannan <akhilkannan10a@gmail.com> <143798318+Alverok@users.noreply.github.com> | ||
| Anarion Zuo <anarionzuo@outlook.com> | ||
| Arun Kota <arunkumarkota@gmail.com> | ||
@@ -85,0 +86,0 @@ Arun Kota <arunkumarkota@gmail.com> Arun Kota <arunkota@Aruns-iMac.local> |
@@ -8,2 +8,3 @@ ************* | ||
| 2.4.5 <release/2.4.5-notes> | ||
| 2.4.4 <release/2.4.4-notes> | ||
@@ -10,0 +11,0 @@ 2.4.3 <release/2.4.3-notes> |
@@ -7,3 +7,3 @@ .. currentmodule:: numpy | ||
| The NumPy 2.4.3 is a patch release that fixes bugs discovered after the 2.4.2 | ||
| The NumPy 2.4.4 is a patch release that fixes bugs discovered after the 2.4.3 | ||
| release. It should finally close issue #30816, the OpenBLAS threading problem | ||
@@ -10,0 +10,0 @@ on ARM. |
@@ -874,3 +874,10 @@ """ | ||
| def blas_fpe_check(): | ||
| # Check if BLAS adds spurious FPEs, mostly seen on M4 arms with Accelerate. | ||
| if sys.platform != "darwin": | ||
| # We currently assume this is limited to MacOS as downstream NumPy | ||
| # import during dlopen caused a deadlock regression: gh-31284 | ||
| return | ||
| # Check if BLAS adds spurious FPEs, seen on M4 arms with Accelerate. | ||
| # In this case we disable FPE reporting since the use of SME poisons | ||
| # it and Accelerate doesn't sanitize them. | ||
| with errstate(all='raise'): | ||
@@ -877,0 +884,0 @@ x = ones((20, 20)) |
@@ -35,2 +35,4 @@ #mesondefine SIZEOF_PY_INTPTR_T | ||
| #mesondefine HAVE___BUILTIN_MUL_OVERFLOW | ||
| #mesondefine HAVE___BUILTIN_ADD_OVERFLOW | ||
| #mesondefine HAVE___BUILTIN_SUB_OVERFLOW | ||
| #mesondefine HAVE___BUILTIN_PREFETCH | ||
@@ -37,0 +39,0 @@ |
@@ -1228,3 +1228,3 @@ """ | ||
| # to reshape / transpose ``ab`` after the matmul | ||
| out[:] = ab | ||
| out[...] = ab | ||
| ab = out | ||
@@ -1231,0 +1231,0 @@ elif output_order is not None: |
@@ -136,2 +136,3 @@ # ruff: noqa: ANN401 | ||
| _PyScalar: TypeAlias = complex | bytes | str | ||
| _PyScalarT = TypeVar("_PyScalarT", bound=_PyScalar) | ||
@@ -575,4 +576,5 @@ # TODO: Fix overlapping overloads: https://github.com/numpy/numpy/issues/27032 | ||
| # this prevents `Any` from being returned with Pyright | ||
| @overload | ||
| # `collections.abc.Sequence` can't be used here because `bytes` and `str` are | ||
| # subtypes of it, which would make the return types incompatible. | ||
| @overload # this prevents `Any` from being returned with Pyright | ||
| def shape(a: _SupportsShape[Never]) -> _AnyShape: ... | ||
@@ -583,10 +585,9 @@ @overload | ||
| def shape(a: _PyScalar) -> tuple[()]: ... | ||
| # `collections.abc.Sequence` can't be used hesre, since `bytes` and `str` are | ||
| # subtypes of it, which would make the return types incompatible. | ||
| @overload # an unbound type variable is used because `list` is invariant | ||
| def shape(a: _PyArray[_PyScalarT]) -> tuple[int]: ... | ||
| @overload | ||
| def shape(a: _PyArray[_PyScalar]) -> tuple[int]: ... | ||
| def shape(a: Sequence[_PyArray[_PyScalarT]]) -> tuple[int, int]: ... | ||
| @overload | ||
| def shape(a: _PyArray[_PyArray[_PyScalar]]) -> tuple[int, int]: ... | ||
| # this overload will be skipped by typecheckers that don't support PEP 688 | ||
| @overload | ||
| def shape(a: Sequence[Sequence[_PyArray[_PyScalarT]]]) -> tuple[int, int, int]: ... | ||
| @overload # this will be skipped by typecheckers that don't support PEP 688 | ||
| def shape(a: memoryview | bytearray) -> tuple[int]: ... | ||
@@ -593,0 +594,0 @@ @overload |
@@ -395,7 +395,7 @@ #ifndef NUMPY_CORE_INCLUDE_NUMPY_NPY_COMMON_H_ | ||
| #if defined(_MSC_VER) && !defined(__INTEL_COMPILER) | ||
| #if defined(_MSC_VER) && !defined(__INTEL_COMPILER) && !defined(__INTEL_LLVM_COMPILER) | ||
| typedef _Dcomplex npy_cdouble; | ||
| typedef _Fcomplex npy_cfloat; | ||
| typedef _Lcomplex npy_clongdouble; | ||
| #else /* !defined(_MSC_VER) || defined(__INTEL_COMPILER) */ | ||
| #else /* !defined(_MSC_VER) || defined(__INTEL_COMPILER) && !defined(__INTEL_LLVM_COMPILER) */ | ||
| typedef double _Complex npy_cdouble; | ||
@@ -402,0 +402,0 @@ typedef float _Complex npy_cfloat; |
@@ -11,2 +11,16 @@ #ifndef NUMPY_CORE_SRC_COMMON_NPY_EXTINT128_H_ | ||
| /* | ||
| * Integer add/sub/mul with overflow checking. | ||
| * | ||
| * On overflow, *overflow_flag is set to 1 and the return value is | ||
| * unspecified (callers must not use it). The arithmetic itself is | ||
| * never performed on values that would overflow signed `npy_int64`, | ||
| * so these helpers are free of the signed-overflow undefined behavior | ||
| * that an unguarded `a + b` / `a - b` / `a * b` would have. | ||
| * | ||
| * `__builtin_{add,sub,mul}_overflow` are probed independently by the | ||
| * meson build (see `numpy/_core/meson.build`); fall back to a | ||
| * branch-and-skip implementation otherwise. | ||
| */ | ||
| /* Integer addition with overflow checking */ | ||
@@ -16,9 +30,19 @@ static inline npy_int64 | ||
| { | ||
| #ifdef HAVE___BUILTIN_ADD_OVERFLOW | ||
| npy_int64 result; | ||
| if (__builtin_add_overflow(a, b, &result)) { | ||
| *overflow_flag = 1; | ||
| } | ||
| return result; | ||
| #else | ||
| if (a > 0 && b > NPY_MAX_INT64 - a) { | ||
| *overflow_flag = 1; | ||
| return 0; | ||
| } | ||
| else if (a < 0 && b < NPY_MIN_INT64 - a) { | ||
| if (a < 0 && b < NPY_MIN_INT64 - a) { | ||
| *overflow_flag = 1; | ||
| return 0; | ||
| } | ||
| return a + b; | ||
| #endif | ||
| } | ||
@@ -31,9 +55,19 @@ | ||
| { | ||
| #ifdef HAVE___BUILTIN_SUB_OVERFLOW | ||
| npy_int64 result; | ||
| if (__builtin_sub_overflow(a, b, &result)) { | ||
| *overflow_flag = 1; | ||
| } | ||
| return result; | ||
| #else | ||
| if (a >= 0 && b < a - NPY_MAX_INT64) { | ||
| *overflow_flag = 1; | ||
| return 0; | ||
| } | ||
| else if (a < 0 && b > a - NPY_MIN_INT64) { | ||
| if (a < 0 && b > a - NPY_MIN_INT64) { | ||
| *overflow_flag = 1; | ||
| return 0; | ||
| } | ||
| return a - b; | ||
| #endif | ||
| } | ||
@@ -46,5 +80,13 @@ | ||
| { | ||
| #ifdef HAVE___BUILTIN_MUL_OVERFLOW | ||
| npy_int64 result; | ||
| if (__builtin_mul_overflow(a, b, &result)) { | ||
| *overflow_flag = 1; | ||
| } | ||
| return result; | ||
| #else | ||
| if (a > 0) { | ||
| if (b > NPY_MAX_INT64 / a || b < NPY_MIN_INT64 / a) { | ||
| *overflow_flag = 1; | ||
| return 0; | ||
| } | ||
@@ -55,8 +97,11 @@ } | ||
| *overflow_flag = 1; | ||
| return 0; | ||
| } | ||
| else if (b < 0 && a < NPY_MAX_INT64 / b) { | ||
| if (b < 0 && a < NPY_MAX_INT64 / b) { | ||
| *overflow_flag = 1; | ||
| return 0; | ||
| } | ||
| } | ||
| return a * b; | ||
| #endif | ||
| } | ||
@@ -63,0 +108,0 @@ |
@@ -289,3 +289,3 @@ #ifndef NPY_SIMD | ||
| { | ||
| npyv_b64 overflow = npyv_and_b64(vec_cmpeq(a, npyv_setall_s64(-1LL << 63)), (npyv_b64)divisor.val[1]); | ||
| npyv_b64 overflow = npyv_and_b64(vec_cmpeq(a, npyv_setall_s64(0x8000000000000000LL)), (npyv_b64)divisor.val[1]); | ||
| npyv_s64 d = vec_sel(divisor.val[0], npyv_setall_s64(1), overflow); | ||
@@ -292,0 +292,0 @@ return vec_div(a, d); |
@@ -445,5 +445,5 @@ /* | ||
| PyDataMem_UserFREE(fa->data, nbytes, fa->mem_handler); | ||
| Py_DECREF(fa->mem_handler); | ||
| } | ||
| } | ||
| Py_CLEAR(fa->mem_handler); | ||
@@ -450,0 +450,0 @@ /* must match allocation in PyArray_NewFromDescr */ |
@@ -832,3 +832,3 @@ #define NPY_NO_DEPRECATED_API NPY_API_VERSION | ||
| if (PyArray_ISCOMPLEX(self) || PyArray_ISOBJECT(self) || | ||
| PyArray_ISUSERDEF(self)) { | ||
| PyArray_ISUSERDEF(self) || !NPY_DT_is_legacy(PyArray_DESCR(self))) { | ||
| if (out == NULL) { | ||
@@ -835,0 +835,0 @@ return PyArray_GenericUnaryFunction(self, |
@@ -1631,5 +1631,25 @@ #define NPY_NO_DEPRECATED_API NPY_API_VERSION | ||
| #endif | ||
| #if NPY_BYTE_ORDER == NPY_BIG_ENDIAN | ||
| #if NPY_SIMD_WIDTH == 16 | ||
| arr[0] = npy_bswap8(arr[0]); | ||
| #elif NPY_SIMD_WIDTH == 32 | ||
| arr[0] = npy_bswap8(arr[0]); | ||
| arr[1] = npy_bswap8(arr[1]); | ||
| #else | ||
| arr[0] = npy_bswap8(arr[0]); | ||
| arr[1] = npy_bswap8(arr[1]); | ||
| arr[2] = npy_bswap8(arr[2]); | ||
| arr[3] = npy_bswap8(arr[3]); | ||
| #endif | ||
| #endif | ||
| memcpy(outptr, arr, sizeof(arr)); | ||
| outptr += vstepx4; | ||
| } else { | ||
| #if NPY_BYTE_ORDER == NPY_BIG_ENDIAN | ||
| bb[0] = npy_bswap8(bb[0]); | ||
| bb[1] = npy_bswap8(bb[1]); | ||
| bb[2] = npy_bswap8(bb[2]); | ||
| bb[3] = npy_bswap8(bb[3]); | ||
| #endif | ||
| for(int i = 0; i < 4; i++) { | ||
@@ -1649,2 +1669,7 @@ for (int j = 0; j < vstep; j++) { | ||
| npy_uint64 bb = npyv_tobits_b8(npyv_cmpneq_u8(va, v_zero)); | ||
| #if NPY_BYTE_ORDER == NPY_BIG_ENDIAN | ||
| bb = npy_bswap8(bb); | ||
| #endif | ||
| for (int i = 0; i < vstep; ++i) { | ||
@@ -1651,0 +1676,0 @@ memcpy(outptr, (char*)&bb + i, 1); |
@@ -426,3 +426,3 @@ import os | ||
| def load_flags(self): | ||
| self.load_flags_auxv() | ||
| self.load_flags_cpuinfo("features") | ||
@@ -429,0 +429,0 @@ |
@@ -389,2 +389,7 @@ """ | ||
| self.assert_deprecated(lambda: np.dtype("f8", align=3)) | ||
| self.assert_deprecated(lambda: np.dtype("f8", align=0, copy=10**100)) | ||
| self.assert_deprecated(lambda: np.dtype("f8", align=10**100, copy=0)) | ||
| # Subclasses of ints don't hit the below pickle code path: | ||
| self.assert_deprecated( | ||
| lambda: np.dtype("f8", align=np.long(0), copy=np.long(1))) | ||
@@ -395,2 +400,4 @@ @pytest.mark.parametrize("align", [True, False, np.True_, np.False_]) | ||
| self.assert_not_deprecated(lambda: np.dtype("f8", align=align)) | ||
| # The following specific case is used by old pickles: | ||
| self.assert_not_deprecated(lambda: np.dtype("f8", align=0, copy=1)) | ||
@@ -397,0 +404,0 @@ |
@@ -765,2 +765,10 @@ import itertools | ||
| def test_einsum_0d_out(self): | ||
| # Issue gh-31350, a zero-dimensional out must not cause an error | ||
| # with optimize='optimal' | ||
| a = np.ones(7) | ||
| out = np.array(0) | ||
| np.einsum('i,i->', a, a, out=out, optimize='optimal') | ||
| assert_equal(out, 7) | ||
| def test_object_loop(self): | ||
@@ -767,0 +775,0 @@ |
@@ -24,4 +24,2 @@ import os | ||
| IS_AVX512FP16 = __cpu_features__.get('AVX512FP16', False) | ||
| # only run on linux with AVX, also avoid old glibc (numpy/numpy#20448). | ||
@@ -88,4 +86,2 @@ runtest = (sys.platform.startswith('linux') | ||
| @pytest.mark.skipif(IS_AVX512FP16, | ||
| reason="SVML FP16 have slightly higher ULP errors") | ||
| @pytest.mark.parametrize("ufunc", UNARY_OBJECT_UFUNCS) | ||
@@ -99,37 +95,1 @@ def test_validate_fp16_transcendentals(self, ufunc): | ||
| maxulp=1, dtype=np.float16) | ||
| @pytest.mark.skipif(not IS_AVX512FP16, | ||
| reason="lower ULP only apply for SVML FP16") | ||
| def test_validate_svml_fp16(self): | ||
| max_ulp_err = { | ||
| "arccos": 2.54, | ||
| "arccosh": 2.09, | ||
| "arcsin": 3.06, | ||
| "arcsinh": 1.51, | ||
| "arctan": 2.61, | ||
| "arctanh": 1.88, | ||
| "cbrt": 1.57, | ||
| "cos": 1.43, | ||
| "cosh": 1.33, | ||
| "exp2": 1.33, | ||
| "exp": 1.27, | ||
| "expm1": 0.53, | ||
| "log": 1.80, | ||
| "log10": 1.27, | ||
| "log1p": 1.88, | ||
| "log2": 1.80, | ||
| "sin": 1.88, | ||
| "sinh": 2.05, | ||
| "tan": 2.26, | ||
| "tanh": 3.00, | ||
| } | ||
| with np.errstate(all='ignore'): | ||
| arr = np.arange(65536, dtype=np.int16) | ||
| datafp16 = np.frombuffer(arr.tobytes(), dtype=np.float16) | ||
| datafp32 = datafp16.astype(np.float32) | ||
| for func in max_ulp_err: | ||
| ufunc = getattr(np, func) | ||
| ulp = np.ceil(max_ulp_err[func]) | ||
| assert_array_max_ulp(ufunc(datafp16), ufunc(datafp32), | ||
| maxulp=ulp, dtype=np.float16) |
@@ -1,3 +0,3 @@ | ||
| from collections.abc import Sequence # noqa: F811 | ||
| from typing import Any, Protocol, TypeAlias, TypedDict, TypeVar | ||
| from collections.abc import Sequence | ||
| from typing import Any, Protocol, TypeAlias, TypedDict, TypeVar, runtime_checkable | ||
@@ -44,2 +44,3 @@ import numpy as np | ||
| @runtime_checkable | ||
| class _HasDType(Protocol[_DTypeT_co]): | ||
@@ -50,2 +51,3 @@ @property | ||
| @runtime_checkable | ||
| class _HasNumPyDType(Protocol[_DTypeT_co]): | ||
@@ -52,0 +54,0 @@ @property |
| """A module containing the `_NestedSequence` protocol.""" | ||
| from typing import TYPE_CHECKING, Any, Protocol, TypeVar, runtime_checkable | ||
| from typing import TYPE_CHECKING, Any, Protocol, runtime_checkable | ||
| if TYPE_CHECKING: | ||
| from collections.abc import Iterator | ||
| from typing_extensions import TypeVar | ||
| _T_co = TypeVar("_T_co", covariant=True, default=Any) | ||
| else: | ||
| from typing import TypeVar | ||
| _T_co = TypeVar("_T_co", covariant=True) | ||
| __all__ = ["_NestedSequence"] | ||
| _T_co = TypeVar("_T_co", covariant=True) | ||
| @runtime_checkable | ||
@@ -14,0 +20,0 @@ class _NestedSequence(Protocol[_T_co]): |
@@ -73,3 +73,3 @@ """ | ||
| 'complex_double': 'NPY_CDOUBLE', | ||
| 'complex_long_double': 'NPY_CDOUBLE', | ||
| 'complex_long_double': 'NPY_CLONGDOUBLE', | ||
| 'string': 'NPY_STRING', | ||
@@ -76,0 +76,0 @@ 'character': 'NPY_STRING'} |
@@ -238,15 +238,15 @@ from _typeshed import Incomplete, SupportsLenAndGetItem | ||
| @overload | ||
| def ix_(*args: _FiniteNestedSequence[_HasDType[_DTypeT]]) -> tuple[np.ndarray[_AnyShape, _DTypeT], ...]: ... | ||
| def ix_() -> tuple[()]: ... | ||
| @overload | ||
| def ix_(*args: str | _NestedSequence[str]) -> tuple[NDArray[np.str_], ...]: ... | ||
| def ix_(*args: Sequence[_HasDType[_DTypeT]] | _HasDType[_DTypeT]) -> tuple[np.ndarray[_AnyShape, _DTypeT], ...]: ... | ||
| @overload | ||
| def ix_(*args: bytes | _NestedSequence[bytes]) -> tuple[NDArray[np.bytes_], ...]: ... | ||
| def ix_(*args: Sequence[str]) -> tuple[NDArray[np.str_], ...]: ... | ||
| @overload | ||
| def ix_(*args: bool | _NestedSequence[bool]) -> tuple[NDArray[np.bool], ...]: ... | ||
| def ix_(*args: Sequence[bytes]) -> tuple[NDArray[np.bytes_], ...]: ... | ||
| @overload | ||
| def ix_(*args: int | _NestedSequence[int]) -> tuple[NDArray[np.intp], ...]: ... | ||
| def ix_(*args: Sequence[int]) -> tuple[NDArray[np.intp], ...]: ... | ||
| @overload | ||
| def ix_(*args: float | _NestedSequence[float]) -> tuple[NDArray[np.float64], ...]: ... | ||
| def ix_(*args: Sequence[float]) -> tuple[NDArray[np.float64], ...]: ... | ||
| @overload | ||
| def ix_(*args: complex | _NestedSequence[complex]) -> tuple[NDArray[np.complex128], ...]: ... | ||
| def ix_(*args: Sequence[complex]) -> tuple[NDArray[np.complex128], ...]: ... | ||
@@ -253,0 +253,0 @@ # |
@@ -34,2 +34,3 @@ from collections.abc import Callable, Sequence | ||
| _ArrayLikeFloat_co, | ||
| _ArrayLikeInt, | ||
| _ArrayLikeInt_co, | ||
@@ -229,10 +230,4 @@ _ArrayLikeObject_co, | ||
| @overload | ||
| def tile( | ||
| A: _ArrayLike[_ScalarT], | ||
| reps: int | Sequence[int], | ||
| ) -> NDArray[_ScalarT]: ... | ||
| def tile(A: _ArrayLike[_ScalarT], reps: _ArrayLikeInt) -> NDArray[_ScalarT]: ... | ||
| @overload | ||
| def tile( | ||
| A: ArrayLike, | ||
| reps: int | Sequence[int], | ||
| ) -> NDArray[Any]: ... | ||
| def tile(A: ArrayLike, reps: _ArrayLikeInt) -> NDArray[Any]: ... |
| from collections.abc import Iterable | ||
| from typing import Any, SupportsIndex, TypeVar, overload | ||
| from typing import Any, TypeVar, overload | ||
@@ -41,3 +41,3 @@ from numpy import generic | ||
| window_shape: int | Iterable[int], | ||
| axis: SupportsIndex | None = None, | ||
| axis: int | tuple[int, ...] | None = None, | ||
| *, | ||
@@ -51,3 +51,3 @@ subok: bool = False, | ||
| window_shape: int | Iterable[int], | ||
| axis: SupportsIndex | None = None, | ||
| axis: int | tuple[int, ...] | None = None, | ||
| *, | ||
@@ -54,0 +54,0 @@ subok: bool = False, |
@@ -27,2 +27,6 @@ """Tests for :mod:`_core.fromnumeric`.""" | ||
| _py_list_1d: list[int] | ||
| _py_list_2d: list[list[int]] | ||
| _py_list_3d: list[list[list[int]]] | ||
| # integer‑dtype subclass for argmin/argmax | ||
@@ -144,3 +148,6 @@ class NDArrayIntSubclass(npt.NDArray[np.intp]): ... | ||
| assert_type(np.shape([[2]]), tuple[int, int]) | ||
| assert_type(np.shape([[[3]]]), tuple[Any, ...]) | ||
| assert_type(np.shape([[[3]]]), tuple[int, int, int]) | ||
| assert_type(np.shape(_py_list_1d), tuple[int]) | ||
| assert_type(np.shape(_py_list_2d), tuple[int, int]) | ||
| assert_type(np.shape(_py_list_3d), tuple[int, int, int]) | ||
| assert_type(np.shape(AR_b), tuple[Any, ...]) | ||
@@ -147,0 +154,0 @@ assert_type(np.shape(AR_nd), tuple[Any, ...]) |
@@ -61,3 +61,3 @@ from types import EllipsisType | ||
| assert_type(np.ix_(AR_LIKE_b), tuple[npt.NDArray[np.bool], ...]) | ||
| assert_type(np.ix_(AR_LIKE_b), tuple[npt.NDArray[np.intp], ...]) | ||
| assert_type(np.ix_(AR_LIKE_i, AR_LIKE_f), tuple[npt.NDArray[np.float64], ...]) | ||
@@ -64,0 +64,0 @@ assert_type(np.ix_(AR_i8), tuple[npt.NDArray[np.int64], ...]) |
+2
-2
@@ -5,8 +5,8 @@ | ||
| """ | ||
| version = "2.4.4" | ||
| version = "2.4.5" | ||
| __version__ = version | ||
| full_version = version | ||
| git_revision = "be93fe2960dbf49b4647f5783c66d967fb2c65b5" | ||
| git_revision = "26e81854b03fea36ac2b21e3158756fdd40f19bb" | ||
| release = 'dev' not in version and '+' not in version | ||
| short_version = version.split("+")[0] |
+1
-1
| Metadata-Version: 2.4 | ||
| Name: numpy | ||
| Version: 2.4.4 | ||
| Version: 2.4.5 | ||
| Summary: Fundamental package for array computing in Python | ||
@@ -5,0 +5,0 @@ Author: Travis E. Oliphant et al. |
+1
-1
@@ -10,3 +10,3 @@ [build-system] | ||
| name = "numpy" | ||
| version = "2.4.4" | ||
| version = "2.4.5" | ||
| description = "Fundamental package for array computing in Python" | ||
@@ -13,0 +13,0 @@ authors = [{name = "Travis E. Oliphant et al."}] |
Sorry, the diff of this file is not supported yet
| name: Native ppc64le Linux Test | ||
| on: | ||
| pull_request: | ||
| branches: | ||
| - main | ||
| - maintenance/** | ||
| paths-ignore: | ||
| - '**.pyi' | ||
| - '**.md' | ||
| - '**.rst' | ||
| workflow_dispatch: | ||
| permissions: | ||
| contents: read | ||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
| cancel-in-progress: true | ||
| jobs: | ||
| native_ppc64le: | ||
| # This job runs only in the main NumPy repository. | ||
| # It requires a native ppc64le GHA runner, which is not available on forks. | ||
| # For more details, see: https://github.com/numpy/numpy/issues/29125 | ||
| if: github.repository == 'numpy/numpy' | ||
| runs-on: ubuntu-24.04-ppc64le-p10 | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| config: | ||
| - name: "GCC" | ||
| args: "-Dallow-noblas=false" | ||
| - name: "clang" | ||
| args: "-Dallow-noblas=false" | ||
| name: "${{ matrix.config.name }}" | ||
| steps: | ||
| - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 | ||
| with: | ||
| submodules: recursive | ||
| fetch-tags: true | ||
| - name: Install dependencies | ||
| run: | | ||
| sudo apt update | ||
| sudo apt install -y python3.12 python3-pip python3-dev ninja-build gfortran \ | ||
| build-essential libopenblas-dev liblapack-dev pkg-config | ||
| pip install --upgrade pip | ||
| pip install -r requirements/build_requirements.txt -r requirements/test_requirements.txt | ||
| echo "/home/runner/.local/bin" >> $GITHUB_PATH | ||
| - name: Install clang | ||
| if: matrix.config.name == 'clang' | ||
| run: | | ||
| sudo apt install -y clang | ||
| export CC=clang | ||
| export CXX=clang++ | ||
| - name: Meson Build | ||
| run: | | ||
| spin build -- ${{ matrix.config.args }} | ||
| - name: Meson Log | ||
| if: always() | ||
| run: cat build/meson-logs/meson-log.txt | ||
| - name: Run Tests | ||
| run: | | ||
| spin test -- --timeout=60 --durations=10 |
| modified_clone: &MODIFIED_CLONE | ||
| # makes sure that for a PR the CI runs against a merged main | ||
| clone_script: | | ||
| if [ -z "$CIRRUS_PR" ]; then | ||
| # if you're not in a PR then clone against the branch name that was pushed to. | ||
| git clone --recursive --branch=$CIRRUS_BRANCH https://x-access-token:${CIRRUS_REPO_CLONE_TOKEN}@github.com/${CIRRUS_REPO_FULL_NAME}.git $CIRRUS_WORKING_DIR | ||
| git reset --hard $CIRRUS_CHANGE_IN_REPO | ||
| else | ||
| # it's a PR so clone the main branch then merge the changes from the PR | ||
| git clone https://x-access-token:${CIRRUS_REPO_CLONE_TOKEN}@github.com/${CIRRUS_REPO_FULL_NAME}.git $CIRRUS_WORKING_DIR | ||
| git fetch origin pull/$CIRRUS_PR/head:pull/$CIRRUS_PR | ||
| # CIRRUS_BASE_BRANCH will probably be `main` for the majority of the time | ||
| # However, if you do a PR against a maintenance branch we will want to | ||
| # merge the PR into the maintenance branch, not main | ||
| git checkout $CIRRUS_BASE_BRANCH | ||
| # alpine git package needs default user.name and user.email to be set before a merge | ||
| git -c user.email="you@example.com" merge --no-commit pull/$CIRRUS_PR | ||
| git submodule update --init --recursive | ||
| fi | ||
| freebsd_test_task: | ||
| use_compute_credits: $CIRRUS_USER_COLLABORATOR == 'true' | ||
| compute_engine_instance: | ||
| image_project: freebsd-org-cloud-dev | ||
| image: family/freebsd-14-3 | ||
| platform: freebsd | ||
| cpu: 1 | ||
| memory: 4G | ||
| install_devtools_script: | | ||
| pkg install -y git bash ninja ccache blas cblas lapack pkgconf | ||
| pkg install -y python311 | ||
| <<: *MODIFIED_CLONE | ||
| ccache_cache: | ||
| folder: .ccache | ||
| populate_script: | ||
| - mkdir -p .ccache | ||
| fingerprint_key: ccache-freebsd | ||
| prepare_env_script: | | ||
| # Create a venv (the `source` command needs bash, not the default sh shell) | ||
| chsh -s /usr/local/bin/bash | ||
| python3.11 -m venv .venv | ||
| source .venv/bin/activate | ||
| # Minimal build and test requirements | ||
| python3.11 -m pip install -U pip | ||
| python3.11 -m pip install meson-python Cython pytest hypothesis | ||
| build_script: | | ||
| chsh -s /usr/local/bin/bash | ||
| source .venv/bin/activate | ||
| python3.11 -m pip install . --no-build-isolation -v -Csetup-args="-Dallow-noblas=false" | ||
| test_script: | | ||
| chsh -s /usr/local/bin/bash | ||
| source .venv/bin/activate | ||
| cd tools | ||
| python3.11 -m pytest --pyargs numpy -m "not slow" | ||
| ccache -s | ||
| on_failure: | ||
| debug_script: | | ||
| cat build/meson-logs/meson-log.txt |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
67202918
0.01%8248
0.01%440361
0.01%